feat(FinalizeDocument): aus CommonJobs kopiert, mit einfachen Fehlerbehebungen unter Verwendung von Copilot
- Programmiersprache von VSC zu C# geändert - Framework von .NET Framework zu .NET geändert
This commit is contained in:
26
EnvelopeGenerator.ServiceHost/Jobs/Infrastructure/Logging.cs
Normal file
26
EnvelopeGenerator.ServiceHost/Jobs/Infrastructure/Logging.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace DigitalData.Modules.Logging;
|
||||
|
||||
public class LogConfig
|
||||
{
|
||||
public bool Debug { get; set; }
|
||||
|
||||
public Logger GetLogger() => new();
|
||||
}
|
||||
|
||||
public class Logger
|
||||
{
|
||||
public void Debug(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}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user