using System; using Microsoft.Extensions.Logging; using NLog; using NLog.Config; using Quadarax.Foundation.Core.Logging; using Quadarax.Foundation.Core.Object; using LogLevel = Microsoft.Extensions.Logging.LogLevel; namespace Quadarax.Foundation.Core.NLog { public class LoggerFactory : Singleton, IQLogger { public static string ConfigurationFileName { get; set; } public void Configure(string configurationFileName) { if (!string.IsNullOrEmpty(configurationFileName)) { LogManager.Configuration = new XmlLoggingConfiguration(configurationFileName); var log = Instance.GetLogger(GetType()); log.Log(LogSeverityEnum.Debug, $"NLOG initialized from configuration file '{configurationFileName}'"); } } public IQLog GetLogger(string loggerName) { return Instance.GetLogger(loggerName); } public IQLog GetLogger(Type loggerForType) { return Instance.GetLogger(loggerForType); } IQLog IQLogger.GetLogger(string loggerName) { return new Logger(loggerName); } IQLog IQLogger.GetLogger(Type loggerForType) { return new Logger(loggerForType); } public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) { throw new NotImplementedException(); } public bool IsEnabled(LogLevel logLevel) { throw new NotImplementedException(); } public IDisposable BeginScope(TState state) where TState : notnull { throw new NotImplementedException(); } } }