internal static void InitHistoryLogger() { if (LogManager.Configuration == null) { return; } HistoryTarget historyTarget = LogManager.Configuration.AllTargets.OfType <HistoryTarget>().FirstOrDefault(); if ((historyTarget == null) && !IsUsingCustomConfiguration) { // TODO: We could use some nice HTML layout for this historyTarget = new HistoryTarget("History") { Layout = GeneralLayout, MaxCount = 20 }; LogManager.Configuration.AddTarget(historyTarget); LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, historyTarget)); LogManager.ReconfigExistingLoggers(); } IPC.OnNewHistoryTarget(historyTarget); }
internal static void OnNewHistoryTarget(HistoryTarget historyTarget) { if (historyTarget == null) { ASF.ArchiLogger.LogNullError(nameof(historyTarget)); return; } if (HistoryTarget != null) { HistoryTarget.NewHistoryEntry -= OnNewHistoryEntry; HistoryTarget = null; } historyTarget.NewHistoryEntry += OnNewHistoryEntry; HistoryTarget = historyTarget; }
private static void OnConfigurationChanged(object sender, LoggingConfigurationChangedEventArgs e) { if ((sender == null) || (e == null)) { ASF.ArchiLogger.LogNullError(nameof(sender) + " || " + nameof(e)); return; } InitConsoleLoggers(); if (IsWaitingForUserInput) { OnUserInputStart(); } HistoryTarget historyTarget = LogManager.Configuration.AllTargets.OfType <HistoryTarget>().FirstOrDefault(); IPC.OnNewHistoryTarget(historyTarget); }
internal static void InitHistoryLogger() { if (IsUsingCustomConfiguration || (LogManager.Configuration == null)) { return; } // TODO: We could use some nice HTML layout for this HistoryTarget historyTarget = new HistoryTarget("History") { Layout = GeneralLayout, MaxCount = 20 }; LogManager.Configuration.AddTarget(historyTarget); LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, historyTarget)); LogManager.ReconfigExistingLoggers(); IPC.OnNewHistoryTarget(historyTarget); }