Renamed the Logger.Debug method to Logger.LogDebug for improved clarity and consistency. Updated all usages in PDFBurner, ReportCreator, FinalizeDocumentJob, TempFiles, and Logging.cs. No changes to logging logic or other log levels.
29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
using System.Globalization;
|
|
|
|
namespace DigitalData.Modules.Logging;
|
|
|
|
public class LogConfig
|
|
{
|
|
public bool Debug { get; set; }
|
|
|
|
public Logger GetLogger() => new();
|
|
}
|
|
|
|
public class Logger
|
|
{
|
|
ILogger<LogConfig> logger;
|
|
|
|
public void LogDebug(string message, params object?[] args) => Write("DEBUG", message, args);
|
|
public void Info(string message, params object?[] args) => Write("INFO", message, args);
|
|
public void Warn(string message, params object?[] args) => Write("WARN", message, args);
|
|
public void Warn(Exception exception, string message, params object?[] args) => Write("WARN", message + " " + exception.Message, args);
|
|
public void Error(Exception exception) => Write("ERROR", exception.Message, Array.Empty<object?>());
|
|
public void Error(Exception exception, string message, params object?[] args) => Write("ERROR", message + " " + exception.Message, args);
|
|
|
|
private static void Write(string level, string message, params object?[] args)
|
|
{
|
|
var formatted = args.Length > 0 ? string.Format(CultureInfo.InvariantCulture, message, args) : message;
|
|
Console.WriteLine($"[{level}] {formatted}");
|
|
}
|
|
}
|