feat: change time format and ext for logs

This commit is contained in:
estrogen elf
2025-06-08 02:51:16 -05:00
parent 8821119c18
commit 9515377df9

View File

@@ -12,7 +12,7 @@ namespace Needlework.Net
{ {
var logger = new LoggerConfiguration() var logger = new LoggerConfiguration()
.MinimumLevel.Debug() .MinimumLevel.Debug()
.WriteTo.File("Logs/debug-", rollingInterval: RollingInterval.Day, shared: true) .WriteTo.File("Logs/debug-.log", rollingInterval: RollingInterval.Day, shared: true)
.CreateLogger(); .CreateLogger();
logger.Debug("NeedleworkDotNet version: {Version}", Assembly.GetEntryAssembly()?.GetName().Version?.ToString() ?? "0.0.0.0"); logger.Debug("NeedleworkDotNet version: {Version}", Assembly.GetEntryAssembly()?.GetName().Version?.ToString() ?? "0.0.0.0");
logger.Debug("OS description: {Description}", System.Runtime.InteropServices.RuntimeInformation.OSDescription); logger.Debug("OS description: {Description}", System.Runtime.InteropServices.RuntimeInformation.OSDescription);
@@ -21,7 +21,7 @@ namespace Needlework.Net
public static void LogFatal(UnhandledExceptionEventArgs e) public static void LogFatal(UnhandledExceptionEventArgs e)
{ {
File.WriteAllText($"Logs/fatal-{DateTime.Now:HHmmssfff}", e.ExceptionObject.ToString()); File.AppendAllText($"Logs/fatal-{DateTime.Now:yyyyMMdd}.log", e.ExceptionObject.ToString());
} }
} }
} }