25 lines
651 B
C#
25 lines
651 B
C#
using System;
|
|
using Microsoft.Extensions.Configuration;
|
|
using NLog;
|
|
using NLog.Extensions.Logging;
|
|
|
|
namespace ChaosBot
|
|
{
|
|
public class Logging
|
|
{
|
|
public static Logger GenLog(IConfiguration appSettingsHandler)
|
|
{
|
|
try
|
|
{
|
|
LogManager.Configuration = new NLogLoggingConfiguration(appSettingsHandler.GetSection("NLog"));
|
|
|
|
return LogManager.GetCurrentClassLogger();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine($"Logging.Logger: Exception [{ex}] thrown, <[{ex.Message}]>.");
|
|
throw;
|
|
}
|
|
}
|
|
}
|
|
} |