using System;
using NLog;
using Quadarax.Foundation.Core.Logging;

namespace Quadarax.Foundation.Core.NLog
{
    public class Logger : ILog
    {

        private global::NLog.ILogger _logger;
        public string Name { get; }


        public Logger(Type type) : this(type.Name)
        {
        }
        public Logger(string name)
        {
            Name = name;
            _logger = LogManager.GetLogger(name);
        }

        public void Log(LogSeverityEnum severity, int code, string message)
        {
            _logger.Log(severity.ToNLogLevel(), message, code);
        }

        public void Log(LogSeverityEnum severity, string message)
        {
            _logger.Log(severity.ToNLogLevel(), message);
        }

        public void Log(LogSeverityEnum severity, string message, Exception exception)
        {
            _logger.Log(severity.ToNLogLevel(), exception, message);
        }

        public void Log(LogSeverityEnum severity, int code, string message, Exception exception)
        {
            _logger.Log(severity.ToNLogLevel(), exception, message, code);
        }
    }
}
