Show shardid in logs

This commit is contained in:
Master Kwoth 2017-10-29 20:06:48 +01:00
parent 8fff510dc7
commit fb85f0c397
4 changed files with 6 additions and 6 deletions

View File

@ -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" +

View File

@ -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);

View File

@ -61,7 +61,7 @@ namespace NadekoBot
if (shardId < 0)
throw new ArgumentOutOfRangeException(nameof(shardId));
LogSetup.SetupLogger();
LogSetup.SetupLogger(shardId);
_log = LogManager.GetCurrentClassLogger();
TerribleElevatedPermissionCheck();

View File

@ -63,7 +63,7 @@ namespace NadekoBot.Core.Services
public ShardsCoordinator()
{
//load main stuff
LogSetup.SetupLogger();
LogSetup.SetupLogger(-1);
_log = LogManager.GetCurrentClassLogger();
_creds = new BotCredentials();