不再翻译日志

This commit is contained in:
辉鸭蛋
2026-03-01 01:59:52 +08:00
parent 7e944e18fb
commit e3c451cd92

View File

@@ -89,21 +89,22 @@ public partial class App : Application
services.AddSingleton<IMissingTranslationReporter, SupabaseMissingTranslationReporter>();
services.AddSingleton<ITranslationService, JsonTranslationService>();
if ("zh-Hans".Equals(all.OtherConfig.UiCultureInfoName, StringComparison.OrdinalIgnoreCase))
{
services.AddLogging(c => c.AddSerilog());
}
else
{
services.AddLogging(logging =>
{
logging.ClearProviders();
logging.SetMinimumLevel(LogLevel.Debug);
logging.AddFilter("Microsoft", LogLevel.Warning);
logging.AddFilter("Microsoft.Hosting.Lifetime", LogLevel.Warning);
logging.Services.AddSingleton<ILoggerProvider, TranslatingSerilogLoggerProvider>();
});
}
services.AddLogging(c => c.AddSerilog());
// if ("zh-Hans".Equals(all.OtherConfig.UiCultureInfoName, StringComparison.OrdinalIgnoreCase))
// {
// services.AddLogging(c => c.AddSerilog());
// }
// else
// {
// services.AddLogging(logging =>
// {
// logging.ClearProviders();
// logging.SetMinimumLevel(LogLevel.Debug);
// logging.AddFilter("Microsoft", LogLevel.Warning);
// logging.AddFilter("Microsoft.Hosting.Lifetime", LogLevel.Warning);
// logging.Services.AddSingleton<ILoggerProvider, TranslatingSerilogLoggerProvider>();
// });
// }
services.AddLocalization();