示例#1
0
 public void Write(LogEntry message)
 {
     foreach (var provider in providers)
     {
         provider.AppendTo(message);
     }
     WriteMessage(message);
 }
示例#2
0
        protected override void WriteMessage(LogEntry message)
        {
            var level = message.Level.ToNlogLevel();
            var msg = message.ToString();

            logger.Log(level, msg);
            logger.Debug(msg);
            logger.Error(msg);
            logger.Info(msg);
            logger.Info(msg);
        }
        public void AppendTo(LogEntry message)
        {
            try
            {
                if (HttpContext.Current == null) return;
                var request = HttpContext.Current.Request;

                var info = new RequestInfo
                {
                    Url = request.Path,
                    Method = request.HttpMethod,
                    QueryString = request.QueryString.ToString(),
                    PostParameters = request.Form.ToString()
                };

                message.Request = info;
            }
            catch { }
        }
示例#4
0
 protected abstract void WriteMessage(LogEntry message);
示例#5
0
 public void Write(string message, Exception e, LogLevel level = LogLevel.Error, LogSource source = LogSource.App)
 {
     var entry = new LogEntry(message, e, level, source);
     Write(entry);
 }
示例#6
0
 public void Write(string message, LogLevel level = LogLevel.Info, LogSource source = LogSource.App)
 {
     var entry = new LogEntry(message, level, source);
     Write(entry);
 }