public LogData(DateTime timestamp, IDictionary <string, object> fields) { Timestamp = timestamp; if (fields == null) { Fields = new LogField(); } else if (fields is LogField logField) { Fields = logField; } else { Fields = new LogField(fields); } }
public static ISpan Exception(this ISpan span, Exception exception) { if (span == null) { return(span); } if (exception == null) { throw new ArgumentNullException(nameof(exception)); } span.Tags.Error(true); span.Log(LogField.CreateNew().EventError().ErrorKind(exception).Message(exception.Message)); return(span); }
public static ISpan Log(this ISpan span, LogField fields) { return(Log(span, DateTime.Now, fields)); }
public static LogField ServerReceive(this LogField logField) { return(logField?.Event("Server Receive")); }
public static LogField ClientReceive(this LogField logField) { return(logField?.Event("Client Receive")); }
public static LogField ServerSend(this LogField logField) { return(logField?.Event("Server Send")); }
public static LogField ErrorKind <TException>(this LogField logField, TException exception) where TException : Exception { return(logField.ErrorKind(exception?.GetType()?.FullName)); }
public static LogField ClientSend(this LogField logField) { return(logField?.Event("Client Send")); }
public static LogField ErrorObject(this LogField logField, Exception exception) { return(logField.Set(LogFields.ErrorObject, exception.Message)); }
public static LogField ErrorKind <TException>(this LogField logField) where TException : Exception { return(logField.ErrorKind(typeof(TException).FullName)); }
public static LogField ErrorKind(this LogField logField, string errorKind) { return(logField.Set(LogFields.ErrorKind, errorKind)); }
public static LogField Stack(this LogField logField, string stack) { return(logField.Set(LogFields.Stack, stack)); }
public static LogField Message(this LogField logField, string message) { return(logField.Set(LogFields.Message, message)); }
public static LogField EventError(this LogField logField) { return(logField.Set(LogFields.Event, LogFields.Error)); }
public static LogField Event(this LogField logField, string eventName) { return(logField.Set(LogFields.Event, eventName)); }