mirror of
https://github.com/real-zony/ZonyLrcToolsX.git
synced 2025-07-01 20:30:41 +00:00
enhanced: change the console theme color.
This commit is contained in:
parent
0f84621919
commit
e900a92f37
@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using Serilog.Sinks.SystemConsole.Themes;
|
||||
|
||||
namespace ZonyLrcTools.Cli.Infrastructure.Logging;
|
||||
|
||||
public static class CustomConsoleTheme
|
||||
{
|
||||
public static AnsiConsoleTheme Code { get; } = new AnsiConsoleTheme(
|
||||
new Dictionary<ConsoleThemeStyle, string>
|
||||
{
|
||||
[ConsoleThemeStyle.Text] = "\x1b[38;5;0253m",
|
||||
[ConsoleThemeStyle.SecondaryText] = "\x1b[38;5;0246m",
|
||||
[ConsoleThemeStyle.TertiaryText] = "\x1b[38;5;0242m",
|
||||
[ConsoleThemeStyle.Invalid] = "\x1b[33;1m",
|
||||
[ConsoleThemeStyle.Null] = "\x1b[38;5;0038m",
|
||||
[ConsoleThemeStyle.Name] = "\x1b[38;5;0081m",
|
||||
[ConsoleThemeStyle.String] = "\x1b[38;5;0216m",
|
||||
[ConsoleThemeStyle.Number] = "\x1b[38;5;151m",
|
||||
[ConsoleThemeStyle.Boolean] = "\x1b[38;5;0038m",
|
||||
[ConsoleThemeStyle.Scalar] = "\x1b[38;5;0079m",
|
||||
[ConsoleThemeStyle.LevelVerbose] = "\x1b[37m",
|
||||
[ConsoleThemeStyle.LevelDebug] = "\x1b[37m",
|
||||
[ConsoleThemeStyle.LevelInformation] = "\x1b[32m\x1b[48;5;0238m",
|
||||
[ConsoleThemeStyle.LevelWarning] = "\x1b[38;5;0229m",
|
||||
[ConsoleThemeStyle.LevelError] = "\x1b[38;5;0197m\x1b[48;5;0238m",
|
||||
[ConsoleThemeStyle.LevelFatal] = "\x1b[38;5;0197m\x1b[48;5;0238m",
|
||||
});
|
||||
}
|
@ -7,10 +7,12 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
using Serilog.Sinks.SystemConsole.Themes;
|
||||
using ZonyLrcTools.Cli.Commands;
|
||||
using ZonyLrcTools.Cli.Commands.SubCommand;
|
||||
using ZonyLrcTools.Cli.Infrastructure.DependencyInject;
|
||||
using ZonyLrcTools.Cli.Infrastructure.Exceptions;
|
||||
using ZonyLrcTools.Cli.Infrastructure.Logging;
|
||||
|
||||
namespace ZonyLrcTools.Cli
|
||||
{
|
||||
@ -53,7 +55,7 @@ namespace ZonyLrcTools.Cli
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
|
||||
.MinimumLevel.Override("System.Net.Http.HttpClient", LogEventLevel.Error)
|
||||
.Enrich.FromLogContext()
|
||||
.WriteTo.Async(c => c.Console())
|
||||
.WriteTo.Async(c => c.Console(theme: CustomConsoleTheme.Code))
|
||||
.WriteTo.Logger(lc =>
|
||||
{
|
||||
lc.Filter.ByIncludingOnly(lc => lc.Level == LogEventLevel.Warning)
|
||||
|
Loading…
x
Reference in New Issue
Block a user