NadekoBot/NadekoBot.Core/Services/LogSetup.cs
2017-10-29 20:06:48 +01:00

24 lines
654 B
C#

using NLog;
using NLog.Config;
using NLog.Targets;
namespace NadekoBot.Core.Services
{
public class LogSetup
{
public static void SetupLogger(int shardId)
{
var logConfig = new LoggingConfiguration();
var consoleTarget = new ColoredConsoleTarget()
{
Layout = shardId + @" ${date:format=HH\:mm\:ss} ${logger:shortName=True} | ${message}"
};
logConfig.AddTarget("Console", consoleTarget);
logConfig.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, consoleTarget));
LogManager.Configuration = logConfig;
}
}
}