| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- //using System;
- //using System.Diagnostics;
- //using NLog;
- //namespace Xilium.CefGlue.Helpers.Log
- //{
- // public interface ILogInitializer
- // {
- // Logger CreateLogger();
- // }
- // public class NLogLogger : ILogger
- // {
- // private readonly object _syncObject = new object();
- // private readonly ILogInitializer _logInitializer;
- // private volatile Logger _log = null;
- // private class CurrentLogInitilizer : ILogInitializer
- // {
- // public Logger CreateLogger()
- // {
- // return GetCurrentLogger();
- // }
- // }
- // private class NamedLogInitilizer : ILogInitializer
- // {
- // private readonly string _loggerName;
- // internal NamedLogInitilizer(string loggerName)
- // {
- // _loggerName = loggerName;
- // }
- // public Logger CreateLogger()
- // {
- // return LogManager.GetLogger(_loggerName);
- // }
- // }
- // private class TypeLogInitilizer : ILogInitializer
- // {
- // private readonly Type _type;
- // public TypeLogInitilizer(Type type)
- // {
- // _type = type;
- // }
- // public Logger CreateLogger()
- // {
- // return LogManager.GetCurrentClassLogger(_type);
- // }
- // }
- // private Logger Log
- // {
- // get
- // {
- // lock (_syncObject)
- // {
- // if (_log == null)
- // {
- // _log = _logInitializer.CreateLogger();
- // }
- // return _log;
- // }
- // }
- // }
- // public NLogLogger(ILogInitializer logInitializer)
- // {
- // _logInitializer = logInitializer;
- // }
- // public NLogLogger()
- // : this(new CurrentLogInitilizer())
- // {
- // }
- // public NLogLogger(Logger log)
- // {
- // _log = log;
- // _logInitializer = null;
- // }
- // public NLogLogger(string loggerName)
- // : this(new NamedLogInitilizer(loggerName))
- // {
- // }
- // public NLogLogger(Type type)
- // : this(new TypeLogInitilizer(type))
- // {
- // }
- // private static Logger GetCurrentLogger()
- // {
- // string loggerName;
- // Type declaringType;
- // int framesToSkip = 1;
- // do
- // {
- // var frame = new StackFrame(framesToSkip, false);
- // var method = frame.GetMethod();
- // declaringType = method.DeclaringType;
- // if (declaringType == null)
- // {
- // loggerName = method.Name;
- // break;
- // }
- // framesToSkip++;
- // loggerName = declaringType.FullName;
- // } while (declaringType.Module.Name.Equals("mscorlib.dll", StringComparison.OrdinalIgnoreCase));
- // return LogManager.GetLogger(loggerName);
- // }
- // public static ILogger GetLogger()
- // {
- // return new NLogLogger(GetCurrentLogger());
- // }
- // public void TraceException(string message, Exception exception)
- // {
- // Log.TraceException(message, exception);
- // }
- // public void Trace(string message, params object[] args)
- // {
- // Log.Trace(message, args);
- // }
- // public void DebugException(string message, Exception exception)
- // {
- // Log.DebugException(message, exception);
- // }
- // public void Debug(string message, params object[] args)
- // {
- // Log.Debug(message, args);
- // }
- // public void ErrorException(string message, Exception exception)
- // {
- // Log.ErrorException(message, exception);
- // }
- // public void Error(string message, params object[] args)
- // {
- // Log.Error(message, args);
- // }
- // public void FatalException(string message, Exception exception)
- // {
- // Log.FatalException(message, exception);
- // }
- // public void Fatal(string message, params object[] args)
- // {
- // Log.Fatal(message, args);
- // }
- // public void InfoException(string message, Exception exception)
- // {
- // Log.InfoException(message, exception);
- // }
- // public void Info(string message, params object[] args)
- // {
- // Log.Info(message, args);
- // }
- // public void WarnException(string message, Exception exception)
- // {
- // Log.WarnException(message, exception);
- // }
- // public void Warn(string message, params object[] args)
- // {
- // Log.Warn(message, args);
- // }
- // public bool IsTraceEnabled
- // {
- // get
- // {
- // return Log.IsTraceEnabled;
- // }
- // }
- // public bool IsDebugEnabled
- // {
- // get
- // {
- // return Log.IsDebugEnabled;
- // }
- // }
- // public bool IsErrorEnabled
- // {
- // get
- // {
- // return Log.IsErrorEnabled;
- // }
- // }
- // public bool IsFatalEnabled
- // {
- // get
- // {
- // return Log.IsFatalEnabled;
- // }
- // }
- // public bool IsInfoEnabled
- // {
- // get
- // {
- // return Log.IsInfoEnabled;
- // }
- // }
- // public bool IsWarnEnabled
- // {
- // get
- // {
- // return Log.IsWarnEnabled;
- // }
- // }
- // }
- //}
|