mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-16 08:25:28 +00:00
Code cleanup
This commit is contained in:
@@ -31,6 +31,25 @@ namespace ArchiSteamFarm {
|
||||
internal static class Logging {
|
||||
private const string GeneralLayout = @"${date:format=yyyy-MM-dd HH\:mm\:ss}|${processname}-${processid}|${level:uppercase=true}|${logger}|${message}${onexception:inner= ${exception:format=toString,Data}}";
|
||||
|
||||
internal static void InitFormLogger() {
|
||||
RichTextBoxTarget formControlTarget = new RichTextBoxTarget {
|
||||
AutoScroll = true,
|
||||
ControlName = "LogTextBox",
|
||||
FormName = "MainForm",
|
||||
Layout = GeneralLayout,
|
||||
MaxLines = byte.MaxValue,
|
||||
Name = "RichTextBox"
|
||||
};
|
||||
|
||||
formControlTarget.RowColoringRules.Add(new RichTextBoxRowColoringRule("level >= LogLevel.Error", "Red", "Black"));
|
||||
formControlTarget.RowColoringRules.Add(new RichTextBoxRowColoringRule("level >= LogLevel.Warn", "Yellow", "Black"));
|
||||
|
||||
LogManager.Configuration.AddTarget(formControlTarget);
|
||||
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, formControlTarget));
|
||||
|
||||
LogManager.ReconfigExistingLoggers();
|
||||
}
|
||||
|
||||
internal static void InitLoggers() {
|
||||
if (LogManager.Configuration != null) {
|
||||
// User provided custom NLog config, or we have it set already, so don't override it
|
||||
@@ -58,24 +77,5 @@ namespace ArchiSteamFarm {
|
||||
|
||||
LogManager.Configuration = config;
|
||||
}
|
||||
|
||||
internal static void InitFormLogger() {
|
||||
RichTextBoxTarget formControlTarget = new RichTextBoxTarget {
|
||||
AutoScroll = true,
|
||||
ControlName = "LogTextBox",
|
||||
FormName = "MainForm",
|
||||
Layout = GeneralLayout,
|
||||
MaxLines = byte.MaxValue,
|
||||
Name = "RichTextBox"
|
||||
};
|
||||
|
||||
formControlTarget.RowColoringRules.Add(new RichTextBoxRowColoringRule("level >= LogLevel.Error", "Red", "Black"));
|
||||
formControlTarget.RowColoringRules.Add(new RichTextBoxRowColoringRule("level >= LogLevel.Warn", "Yellow", "Black"));
|
||||
|
||||
LogManager.Configuration.AddTarget(formControlTarget);
|
||||
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, formControlTarget));
|
||||
|
||||
LogManager.ReconfigExistingLoggers();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user