mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Add support for detecting history target in wrapper
This commit is contained in:
@@ -38,6 +38,7 @@ using ArchiSteamFarm.Storage;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using NLog.Targets;
|
||||
using NLog.Targets.Wrappers;
|
||||
|
||||
namespace ArchiSteamFarm.NLog;
|
||||
|
||||
@@ -286,7 +287,7 @@ internal static class Logging {
|
||||
return;
|
||||
}
|
||||
|
||||
HistoryTarget? historyTarget = LogManager.Configuration.AllTargets.OfType<HistoryTarget>().FirstOrDefault();
|
||||
HistoryTarget? historyTarget = LogManager.Configuration.AllTargets.Select(static target => target is WrapperTargetBase wrapper ? wrapper.WrappedTarget : target).OfType<HistoryTarget>().FirstOrDefault();
|
||||
|
||||
if ((historyTarget == null) && !IsUsingCustomConfiguration) {
|
||||
historyTarget = new HistoryTarget("History") {
|
||||
@@ -541,7 +542,7 @@ internal static class Logging {
|
||||
OnUserInputStart();
|
||||
}
|
||||
|
||||
HistoryTarget? historyTarget = LogManager.Configuration?.AllTargets.OfType<HistoryTarget>().FirstOrDefault();
|
||||
HistoryTarget? historyTarget = LogManager.Configuration?.AllTargets.Select(static target => target is WrapperTargetBase wrapper ? wrapper.WrappedTarget : target).OfType<HistoryTarget>().FirstOrDefault();
|
||||
ArchiKestrel.OnNewHistoryTarget(historyTarget);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user