using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Project1Demo.Core.CrossCuttingConcerns.Logging.Log4Net
{
    [Serializable]
    public class LoggerService
    {
        private ILog _log;
        public LoggerService(ILog log) 
        {
            _log = log;
        }

        public bool IsInfoEnabled
        {
            get { return _log.IsInfoEnabled; }
        }

        public bool IsWarnEnabled => _log.IsWarnEnabled;
        public bool IsFatalEnabled => _log.IsFatalEnabled;
        public bool IsErrorEnabled => _log.IsErrorEnabled;
        public bool IsDebugEnabled=> _log.IsDebugEnabled;

        public void Info(object logMessage)
        {
            if(IsInfoEnabled) 
            {
                _log.Info(logMessage);
            }
        }

        public void Warn(object logMessage) 
        {
            if (IsWarnEnabled)
            {
                _log.Warn(logMessage);
            }
        }
        public void Error(object logMessage) 
        {
            if (IsErrorEnabled) { _log.Error(logMessage); }
        }

        public void Debug(object logMessage) { if (IsDebugEnabled) { _log.Debug(logMessage); } }
        public void Fatal(object logMessage) { if ( IsFatalEnabled) { _log.Fatal(logMessage); } }
    }
}
