logging changes

This commit is contained in:
2023-06-11 07:54:38 +06:00
parent ea9292f65f
commit aed71aefe0
32 changed files with 106 additions and 178 deletions

View File

@@ -1,4 +1,4 @@
namespace DTLib.Logging.New;
namespace DTLib.Logging;
/// <summary>
/// This class can be used for unite many loggers into one
@@ -49,7 +49,7 @@ public class CompositeLogger : ILogger
}
}
public ILogFormat Format { get; }
public ILogFormat Format { get; set; }
protected ILogger[] _loggers;
private bool _debugLogEnabled =

View File

@@ -1,6 +1,6 @@
using DTLib.Console;
namespace DTLib.Logging.New;
namespace DTLib.Logging;
// вывод лога в консоль и файл
public class ConsoleLogger : ILogger
@@ -14,7 +14,7 @@ public class ConsoleLogger : ILogger
public bool InfoLogEnabled { get; set; } = true;
public bool WarnLogEnabled { get; set; } = true;
public bool ErrorLogEnabled { get; set; } = true;
public ILogFormat Format { get; }
public ILogFormat Format { get; set; }
readonly object consolelocker = new();

View File

@@ -1,4 +1,4 @@
namespace DTLib.Logging.New;
namespace DTLib.Logging;
/// wrapper around ILogger and LoggerExtensions that stores context
public class ContextLogger : ILogger
@@ -50,7 +50,11 @@ public class ContextLogger : ILogger
public void Dispose() => ParentLogger.Dispose();
public ILogFormat Format => ParentLogger.Format;
public ILogFormat Format
{
get => ParentLogger.Format;
set => ParentLogger.Format=value;
}
public bool DebugLogEnabled
{

View File

@@ -1,4 +1,4 @@
namespace DTLib.Logging.New;
namespace DTLib.Logging;
public class FileLogger : ILogger
{
@@ -11,7 +11,7 @@ public class FileLogger : ILogger
public bool InfoLogEnabled { get; set; } = true;
public bool WarnLogEnabled { get; set; } = true;
public bool ErrorLogEnabled { get; set; } = true;
public ILogFormat Format { get; }
public ILogFormat Format { get; set; }
public IOPath LogfileName { get; protected set; }
public System.IO.FileStream LogfileStream { get; protected set; }

View File

@@ -1,9 +1,9 @@
namespace DTLib.Logging.New;
namespace DTLib.Logging;
public interface ILogger : IDisposable
{
ILogFormat Format { get; }
ILogFormat Format { get; set; }
bool DebugLogEnabled { get; set; }
bool InfoLogEnabled { get; set; }
bool WarnLogEnabled { get; set; }