123456789101112131415161718192021222324 |
- using Microsoft.Extensions.Logging.Console;
- namespace PCC2.Init;
- public static class ConsoleApplication
- {
- public static void Init()
- {
- GenericPurposeApplication.Init();
- }
- public static void SetLogFormatForSimpleConsole(this IHostApplicationBuilder builder, bool singleLine = true, string timestampFormat = "[dd HH:mm:ss] ", LoggerColorBehavior colorBehavior = LoggerColorBehavior.Enabled)
- {
- builder.Services.AddLogging(opt =>
- {
- opt.AddSimpleConsole(p =>
- {
- p.TimestampFormat = timestampFormat;
- p.SingleLine = singleLine;
- p.ColorBehavior = colorBehavior;
- });
- });
- }
- }
|