Skip to content

Commit

Permalink
fix ASF log level
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed Jul 23, 2022
1 parent 5c247ca commit 85a04f3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ST.Client/UI/IApplication.Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public static void InitLogDir(string? alias = null)
MaxArchiveDays = 7,
};
objConfig.AddTarget(logfile);
InitializeTarget(objConfig, logfile);
InitializeTarget(objConfig, logfile, defMinLevel);
#if StartWatchTrace
StartWatchTrace.Record("InitLogDir.CreateLoggingConfiguration");
#endif
Expand All @@ -226,27 +226,27 @@ public static void InitLogDir(string? alias = null)
MaxArchiveFiles = 10,
MaxArchiveDays = 7,
};
InitializeTarget(config, fileTarget);
InitializeTarget(config, fileTarget, NLogLevel.Debug);
var historyTarget = new HistoryTarget("History")
{
Layout = ASFPathHelper.NLogGeneralLayout,
MaxCount = 20,
};
InitializeTarget(config, historyTarget);
InitializeTarget(config, historyTarget, NLogLevel.Debug);
ASFNLogManager.Configuration = config;
};

LogDirPath = logDirPath;
void InitializeTarget(LoggingConfiguration config, Target target)
static void InitializeTarget(LoggingConfiguration config, Target target, NLogLevel minLevel)
{
config.AddTarget(target);
if (ThisAssembly.Debuggable)
if (minLevel < NLogLevel.Warn)
{
config.LoggingRules.Add(new LoggingRule("Microsoft*", target) { FinalMinLevel = NLogLevel.Warn });
config.LoggingRules.Add(new LoggingRule("Microsoft.Hosting.Lifetime*", target) { FinalMinLevel = NLogLevel.Info });
config.LoggingRules.Add(new LoggingRule("System*", target) { FinalMinLevel = NLogLevel.Warn });
}
config.LoggingRules.Add(new LoggingRule("*", defMinLevel, target));
config.LoggingRules.Add(new LoggingRule("*", minLevel, target));
}
}

Expand Down

0 comments on commit 85a04f3

Please sign in to comment.