private static void LogFilters(HttpContext context, IObjectWriter c) { var app = context.Features.Get <IAppFeature>()?.App; if (app != null) { c.WriteProperty("appId", app.Id.ToString()); c.WriteProperty("appName", app.Name); } var userId = context.User.OpenIdSubject(); if (!string.IsNullOrWhiteSpace(userId)) { c.WriteProperty(nameof(userId), userId); } var clientId = context.User.OpenIdClientId(); if (!string.IsNullOrWhiteSpace(clientId)) { c.WriteProperty(nameof(clientId), clientId); } var costs = context.Features.Get <IApiCostsFeature>()?.Weight ?? 0; c.WriteProperty(nameof(costs), costs); }
private static void InternalWriteException(IObjectWriter writer, Exception exception) { writer.WriteProperty("message", exception.Message) .WriteProperty("type", exception.GetType().FullName) .WriteProperty("stacktrace", exception.StackTrace); if (exception is AggregateException aggregateException) { writer.WriteArray("inner_exceptions", array => { foreach (Exception innerException in aggregateException.InnerExceptions) { array.WriteObject(x => InternalWriteException(x, innerException)); } }); } else if (exception.InnerException != null) { writer.WriteException(exception.InnerException, "inner_exception"); } }
public void Append(IObjectWriter writer, SemanticLogLevel logLevel, Exception?exception) { var severity = GetSeverity(logLevel); writer.WriteProperty(nameof(severity), severity); }
public void Append(IObjectWriter writer, SemanticLogLevel logLevel) { writer.WriteProperty("timestamp", clock.GetCurrentInstant()); }
public void Append(IObjectWriter writer) { writer.WriteProperty(_fieldName, _timestamp()); }
public void Append(IObjectWriter writer) { writer.WriteProperty("timestamp", timestamp()); }
public void Append(IObjectWriter writer) { writer.WriteProperty("timestamp", clock.GetCurrentInstant()); }
void IAuditFormattable.Write(IObjectWriter writer) { writer.WriteProperty("From", _from); writer.WriteProperty("Until", _until); }
public void Write(IObjectWriter writer) { writer.WriteProperty("Staff", _staff); writer.WriteProperty("Group", _group); }
public void Should_write_boolean_property() { var result = sut.WriteProperty("property", true).ToString(); Assert.Equal(@"{""property"":true}", result); }
public static IObjectWriter DumpObject(this IObjectWriter writer, string property, object obj) { return(writer.WriteProperty(property, JsonConvert.SerializeObject(obj))); }
public static IObjectWriter WriteMessage(this IObjectWriter writer, string message) { return(writer.WriteProperty("message", message)); }
public void Append(IObjectWriter writer, SemanticLogLevel logLevel, Exception?exception) { writer.WriteProperty(nameof(category), category); }