public virtual void BuildEntryText(StringBuilder sb, string categoryName, LogLevel logLevel, EventId eventId, string message, Exception exception, FileLogScope logScope, DateTimeOffset timestamp) { AppendLogLevel(sb, logLevel); AppendCategoryName(sb, categoryName); AppendEventId(sb, eventId); AppendTimestamp(sb, timestamp); if (logScope != null) { AppendLogScopeInfo(sb, logScope); } if (!string.IsNullOrEmpty(message)) { AppendMessage(sb, message); } if (exception != null) { AppendException(sb, exception); } }
protected virtual void AppendLogScopeInfo(StringBuilder sb, FileLogScope logScope) { sb.Append(_messagePadding); var list = new List <FileLogScope>(); do { list.Add(logScope); }while ((logScope = logScope.Parent) != null); var n = list.Count; AppendLogScope(sb, list[n - 1]); for (var i = n - 2; i >= 0; i--) { sb.Append(' '); AppendLogScope(sb, list[i]); } sb.AppendLine(); }
protected virtual void AppendLogScope(StringBuilder sb, FileLogScope logScope) { sb.Append("=> "); sb.Append(logScope); }
public virtual IDisposable BeginScope <TState>(TState state) { return(FileLogScope.Push(state)); }