public void Write(LogEntry message) { foreach (var provider in providers) { provider.AppendTo(message); } WriteMessage(message); }
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 { } }
protected abstract void WriteMessage(LogEntry message);
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); }
public void Write(string message, LogLevel level = LogLevel.Info, LogSource source = LogSource.App) { var entry = new LogEntry(message, level, source); Write(entry); }