From fb85f0c3976a9668b675e79c9d18ca2c74667166 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Sun, 29 Oct 2017 20:06:48 +0100 Subject: [PATCH] Show shardid in logs --- NadekoBot.Core/Services/CommandHandler.cs | 4 ++-- NadekoBot.Core/Services/LogSetup.cs | 4 ++-- NadekoBot.Core/Services/NadekoBot.cs | 2 +- NadekoBot.Core/Services/ShardsCoordinator.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/NadekoBot.Core/Services/CommandHandler.cs b/NadekoBot.Core/Services/CommandHandler.cs index f7cd4e61..3175f03d 100644 --- a/NadekoBot.Core/Services/CommandHandler.cs +++ b/NadekoBot.Core/Services/CommandHandler.cs @@ -160,7 +160,7 @@ namespace NadekoBot.Core.Services private Task LogSuccessfulExecution(IUserMessage usrMsg, ITextChannel channel, params int[] execPoints) { - _log.Info("Command Executed after " + string.Join("/", execPoints.Select(x => x * _oneThousandth)) + "s\n\t" + + _log.Info($"S: {_client.ShardId} | Command Executed after " + string.Join("/", execPoints.Select(x => x * _oneThousandth)) + "s\n\t" + "User: {0}\n\t" + "Server: {1}\n\t" + "Channel: {2}\n\t" + @@ -175,7 +175,7 @@ namespace NadekoBot.Core.Services private void LogErroredExecution(string errorMessage, IUserMessage usrMsg, ITextChannel channel, params int[] execPoints) { - _log.Warn("Command Errored after " + string.Join("/", execPoints.Select(x => x * _oneThousandth)) + "s\n\t" + + _log.Warn($"S: {_client.ShardId} | Command Errored after " + string.Join("/", execPoints.Select(x => x * _oneThousandth)) + "s\n\t" + "User: {0}\n\t" + "Server: {1}\n\t" + "Channel: {2}\n\t" + diff --git a/NadekoBot.Core/Services/LogSetup.cs b/NadekoBot.Core/Services/LogSetup.cs index 6e22854c..fdb41dc0 100644 --- a/NadekoBot.Core/Services/LogSetup.cs +++ b/NadekoBot.Core/Services/LogSetup.cs @@ -6,12 +6,12 @@ namespace NadekoBot.Core.Services { public class LogSetup { - public static void SetupLogger() + public static void SetupLogger(int shardId) { var logConfig = new LoggingConfiguration(); var consoleTarget = new ColoredConsoleTarget() { - Layout = @"${date:format=HH\:mm\:ss} ${logger:shortName=True} | ${message}" + Layout = shardId + @" ${date:format=HH\:mm\:ss} ${logger:shortName=True} | ${message}" }; logConfig.AddTarget("Console", consoleTarget); diff --git a/NadekoBot.Core/Services/NadekoBot.cs b/NadekoBot.Core/Services/NadekoBot.cs index f787fcbf..e4ee216d 100644 --- a/NadekoBot.Core/Services/NadekoBot.cs +++ b/NadekoBot.Core/Services/NadekoBot.cs @@ -61,7 +61,7 @@ namespace NadekoBot if (shardId < 0) throw new ArgumentOutOfRangeException(nameof(shardId)); - LogSetup.SetupLogger(); + LogSetup.SetupLogger(shardId); _log = LogManager.GetCurrentClassLogger(); TerribleElevatedPermissionCheck(); diff --git a/NadekoBot.Core/Services/ShardsCoordinator.cs b/NadekoBot.Core/Services/ShardsCoordinator.cs index 1af17e1a..d312f697 100644 --- a/NadekoBot.Core/Services/ShardsCoordinator.cs +++ b/NadekoBot.Core/Services/ShardsCoordinator.cs @@ -63,7 +63,7 @@ namespace NadekoBot.Core.Services public ShardsCoordinator() { //load main stuff - LogSetup.SetupLogger(); + LogSetup.SetupLogger(-1); _log = LogManager.GetCurrentClassLogger(); _creds = new BotCredentials();