mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-01-11 19:44:44 +00:00
refactor: update log message format for console
This commit is contained in:
@@ -148,7 +148,7 @@ namespace PepperDash.Core
|
|||||||
.MinimumLevel.Verbose()
|
.MinimumLevel.Verbose()
|
||||||
.Enrich.FromLogContext()
|
.Enrich.FromLogContext()
|
||||||
.Enrich.With(new CrestronEnricher())
|
.Enrich.With(new CrestronEnricher())
|
||||||
.WriteTo.Sink(new DebugConsoleSink(new ExpressionTemplate("[{@t}][{@l}][{App}][{Key:3}]{@m}\n{@x}")), levelSwitch: _consoleLoggingLevelSwitch)
|
.WriteTo.Sink(new DebugConsoleSink(new ExpressionTemplate("[{@t:yyyy-MM-dd HH:mm:ss.fff}][{@l:u4}][{App}]{#if Key is not null}[{Key}]{#end} {@m}{#if @x is not null}\r\n{@x}{#end}")), levelSwitch: _consoleLoggingLevelSwitch)
|
||||||
.WriteTo.Sink(_websocketSink, levelSwitch: _websocketLoggingLevelSwitch)
|
.WriteTo.Sink(_websocketSink, levelSwitch: _websocketLoggingLevelSwitch)
|
||||||
.WriteTo.Sink(new DebugErrorLogSink(), levelSwitch: _errorLogLevelSwitch)
|
.WriteTo.Sink(new DebugErrorLogSink(), levelSwitch: _errorLogLevelSwitch)
|
||||||
.WriteTo.File(new RenderedCompactJsonFormatter(), logFilePath,
|
.WriteTo.File(new RenderedCompactJsonFormatter(), logFilePath,
|
||||||
@@ -593,7 +593,7 @@ namespace PepperDash.Core
|
|||||||
/// <param name="args">Args to put into message template</param>
|
/// <param name="args">Args to put into message template</param>
|
||||||
public static void LogMessage(Exception ex, string message, IKeyed device = null, params object[] args)
|
public static void LogMessage(Exception ex, string message, IKeyed device = null, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", device?.Key ?? string.Empty))
|
using (LogContext.PushProperty("Key", device?.Key))
|
||||||
{
|
{
|
||||||
_logger.Error(ex, message, args);
|
_logger.Error(ex, message, args);
|
||||||
}
|
}
|
||||||
@@ -608,7 +608,7 @@ namespace PepperDash.Core
|
|||||||
/// <param name="args">Args to put into message template</param>
|
/// <param name="args">Args to put into message template</param>
|
||||||
public static void LogMessage(LogEventLevel level, string message, IKeyed device=null, params object[] args)
|
public static void LogMessage(LogEventLevel level, string message, IKeyed device=null, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", device?.Key ?? string.Empty))
|
using (LogContext.PushProperty("Key", device?.Key))
|
||||||
{
|
{
|
||||||
_logger.Write(level, message, args);
|
_logger.Write(level, message, args);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user