aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2016-03-09 08:20:06 -0800
committerGravatar Jan Tattermusch <jtattermusch@google.com>2016-03-17 17:56:07 -0700
commiteeb133024594bcb23861dcef0c77a3f6121130b8 (patch)
tree28a8481bc82f07195d80a0199c7385149888fcff
parentceb651048651ea48622dbbb78e3392fa88dd131d (diff)
make timestamp format in C# logs more similar to C core
-rw-r--r--src/csharp/Grpc.Core/Logging/ConsoleLogger.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/csharp/Grpc.Core/Logging/ConsoleLogger.cs b/src/csharp/Grpc.Core/Logging/ConsoleLogger.cs
index 5c5b802164..d41b1b9f26 100644
--- a/src/csharp/Grpc.Core/Logging/ConsoleLogger.cs
+++ b/src/csharp/Grpc.Core/Logging/ConsoleLogger.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -33,12 +33,16 @@
using System;
using System.Collections.Generic;
+using System.Globalization;
namespace Grpc.Core.Logging
{
/// <summary>Logger that logs to System.Console.</summary>
public class ConsoleLogger : ILogger
{
+ // Format similar enough to C core log format except nanosecond precision is not supported.
+ const string DateTimeFormatString = "MMdd HH:mm:ss.ffffff";
+
readonly Type forType;
readonly string forTypeString;
@@ -142,7 +146,7 @@ namespace Grpc.Core.Logging
{
Console.Error.WriteLine("{0}{1} {2}{3}",
severityString,
- DateTime.Now,
+ DateTime.Now.ToString(DateTimeFormatString, CultureInfo.InvariantCulture),
forTypeString,
message);
}