From 70915ecaedd4fd8e371b5667e22495e08227fc8f Mon Sep 17 00:00:00 2001 From: JustArchi Date: Fri, 25 Sep 2020 13:16:53 +0200 Subject: [PATCH] Convert BotName of SteamTarget to Layout --- ArchiSteamFarm/NLog/SteamTarget.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ArchiSteamFarm/NLog/SteamTarget.cs b/ArchiSteamFarm/NLog/SteamTarget.cs index 3d1c79450..4585df7d0 100644 --- a/ArchiSteamFarm/NLog/SteamTarget.cs +++ b/ArchiSteamFarm/NLog/SteamTarget.cs @@ -27,6 +27,7 @@ using ArchiSteamFarm.Localization; using JetBrains.Annotations; using NLog; using NLog.Config; +using NLog.Layouts; using NLog.Targets; namespace ArchiSteamFarm.NLog { @@ -37,7 +38,7 @@ namespace ArchiSteamFarm.NLog { // This is NLog config property, it must have public get() and set() capabilities [PublicAPI] - public string? BotName { get; set; } + public Layout? BotName { get; set; } // This is NLog config property, it must have public get() and set() capabilities [PublicAPI] @@ -72,8 +73,10 @@ namespace ArchiSteamFarm.NLog { Bot? bot = null; - if (!string.IsNullOrEmpty(BotName)) { - bot = Bot.GetBot(BotName!); + string? botName = BotName?.Render(logEvent); + + if (!string.IsNullOrEmpty(botName)) { + bot = Bot.GetBot(botName); if (bot?.IsConnectedAndLoggedOn != true) { return;