-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
126 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -402,4 +402,5 @@ FodyWeavers.xsd | |
appsettings.local.json | ||
CHANGELOG.md | ||
Plugins/ | ||
Canvas/ | ||
Canvas/ | ||
Zones/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
using Serilog; | ||
using Microsoft.Extensions.Logging; | ||
using ZLogger; | ||
|
||
namespace WFDS.Common.Helpers; | ||
|
||
public static class ConsoleHelper | ||
{ | ||
private static readonly ILogger Logger = Log.Factory.CreateLogger(typeof(ConsoleHelper).FullName ?? nameof(ConsoleHelper)); | ||
|
||
public static void UpdateConsoleTitle(string name, string code, int cur, int cap) | ||
{ | ||
var title = $"[{cur}/{cap - 1}] {name} [{code}]"; | ||
Console.Title = title; | ||
Log.Logger.Information("update console title : {0}", title); | ||
Logger.ZLogInformation($"update console title : {title}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Globalization; | ||
using Microsoft.Extensions.Logging; | ||
using ZLogger; | ||
using ZLogger.Providers; | ||
|
||
namespace WFDS.Common; | ||
|
||
public static class Log | ||
{ | ||
public static readonly ILoggerFactory Factory = LoggerFactory.Create(logging => | ||
{ | ||
#if DEBUG | ||
logging.SetMinimumLevel(LogLevel.Debug); | ||
#else | ||
logging.SetMinimumLevel(LogLevel.Information); | ||
#endif | ||
|
||
logging.AddZLoggerConsole(options => | ||
{ | ||
options.IncludeScopes = true; | ||
options.UsePlainTextFormatter(formatter => | ||
{ | ||
formatter.SetPrefixFormatter($"[{0}] [{1:short}] [{2}] [{3}:{4}] ", (in MessageTemplate template, in LogInfo info) => template.Format(info.Timestamp.Utc.ToString("O"), info.LogLevel, info.Category, info.MemberName, info.LineNumber)); | ||
formatter.SetExceptionFormatter((writer, ex) => Utf8StringInterpolation.Utf8String.Format(writer, $"{ex.Message}")); | ||
}); | ||
}); | ||
|
||
logging.AddZLoggerFile("Logs/latest.log", options => | ||
{ | ||
options.UseJsonFormatter(); | ||
}); | ||
logging.AddZLoggerRollingFile(options => | ||
{ | ||
options.FilePathSelector = (DateTimeOffset timestamp, int sequenceNumber) => $"logs/{timestamp.ToLocalTime():yyyyMMdd}_{sequenceNumber:000}.log"; | ||
options.RollingInterval = RollingInterval.Day; | ||
options.RollingSizeKB = 1024; | ||
}); | ||
}); | ||
|
||
public static readonly ILogger Logger = Factory.CreateLogger(""); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.