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