diff --git a/sandbox/ConsoleApp/Program.cs b/sandbox/ConsoleApp/Program.cs index 206abb38..0266b7ad 100644 --- a/sandbox/ConsoleApp/Program.cs +++ b/sandbox/ConsoleApp/Program.cs @@ -16,7 +16,10 @@ { console.ConfigureEnableAnsiEscapeCode = true; console.OutputEncodingToUtf8 = true; - console.UsePlainTextFormatter(); + console.UsePlainTextFormatter(formatter => + { + formatter.SetPrefixFormatter($"{0:timeonly} | {1:short} | ", (template, info) => template.Format(info.Timestamp, info.LogLevel)); + }); }); }); }); diff --git a/src/ZLogger/MessageTemplate.cs b/src/ZLogger/MessageTemplate.cs index f746bb12..957bd4ea 100644 --- a/src/ZLogger/MessageTemplate.cs +++ b/src/ZLogger/MessageTemplate.cs @@ -67,27 +67,26 @@ static void AppendLogLevel(ref Utf8StringWriter> writer, ref { case LogLevel.Trace: writer.AppendUtf8("TRC"u8); - break; + return; case LogLevel.Debug: writer.AppendUtf8("DBG"u8); - break; + return; case LogLevel.Information: writer.AppendUtf8("INF"u8); - break; + return; case LogLevel.Warning: writer.AppendUtf8("WRN"u8); - break; + return; case LogLevel.Error: writer.AppendUtf8("ERR"u8); - break; + return; case LogLevel.Critical: writer.AppendUtf8("CRI"u8); - break; + return; case LogLevel.None: writer.AppendUtf8("NON"u8); - break; + return; default: - writer.AppendFormatted(value); break; } }