From 8daa48222eece1e495530a887ba879fa4332376b Mon Sep 17 00:00:00 2001
From: Ismael Hamed <1279846+ismaelhamed@users.noreply.github.com>
Date: Thu, 29 Sep 2022 15:36:57 +0200
Subject: [PATCH] Allow `LogLevel` template to display milliseconds (#6126)
---
src/core/Akka/Event/LogEvent.cs | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/core/Akka/Event/LogEvent.cs b/src/core/Akka/Event/LogEvent.cs
index 510b0d39eee..811262f6499 100644
--- a/src/core/Akka/Event/LogEvent.cs
+++ b/src/core/Akka/Event/LogEvent.cs
@@ -7,7 +7,6 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Threading;
using Akka.Actor;
@@ -89,16 +88,14 @@ protected LogEvent()
public abstract LogLevel LogLevel();
///
- /// Returns a that represents this LogEvent.
+ /// Returns a that represents this LogEvent.
///
- /// A that represents this LogEvent.
+ /// A that represents this LogEvent.
public override string ToString()
{
- if(Cause == null)
- return
- $"[{LogLevel().PrettyNameFor()}][{Timestamp}][Thread {Thread.ManagedThreadId.ToString().PadLeft(4, '0')}][{LogSource}] {Message}";
- return
- $"[{LogLevel().PrettyNameFor()}][{Timestamp}][Thread {Thread.ManagedThreadId.ToString().PadLeft(4, '0')}][{LogSource}] {Message}{Environment.NewLine}Cause: {Cause}";
+ return Cause == null
+ ? $"[{LogLevel().PrettyNameFor()}][{Timestamp:MM/dd/yyyy hh:mm:ss.fff}][Thread {Thread.ManagedThreadId.ToString().PadLeft(4, '0')}][{LogSource}] {Message}"
+ : $"[{LogLevel().PrettyNameFor()}][{Timestamp:MM/dd/yyyy hh:mm:ss.fff}][Thread {Thread.ManagedThreadId.ToString().PadLeft(4, '0')}][{LogSource}] {Message}{Environment.NewLine}Cause: {Cause}";
}
}
}