public static string GetOutputName(this NewRelicLoggingProperty property) { switch (property) { case NewRelicLoggingProperty.ThreadId: return("thread.id"); case NewRelicLoggingProperty.Timestamp: return("timestamp"); case NewRelicLoggingProperty.ErrorMessage: return("error.message"); case NewRelicLoggingProperty.ErrorClass: return("error.class"); case NewRelicLoggingProperty.ErrorStack: return("error.stack"); case NewRelicLoggingProperty.MessageText: return("message"); case NewRelicLoggingProperty.MessageTemplate: return("message.template"); case NewRelicLoggingProperty.LogLevel: return("log.level"); case NewRelicLoggingProperty.MethodName: return("method.name"); case NewRelicLoggingProperty.ThreadName: return("thread.name"); case NewRelicLoggingProperty.FileName: return("file.name"); case NewRelicLoggingProperty.NameSpace: return("namespace"); case NewRelicLoggingProperty.ClassName: return("class.name"); case NewRelicLoggingProperty.LineNumber: return("line.number"); case NewRelicLoggingProperty.CorrelationId: return("correlation.id"); case NewRelicLoggingProperty.ProcessId: return("process.id"); default: throw new KeyNotFoundException($"New Relic Logging Field {property}"); } }
public NewRelicFormatter WithPropertyMapping(string propertyName, NewRelicLoggingProperty outputAsNewRelicProperty) { if (_reservedProperties.Contains(outputAsNewRelicProperty)) { throw new InvalidOperationException($"The New Relic Serilog Extension does not allow mapping of property {outputAsNewRelicProperty}"); } _propertyMappings[propertyName] = LoggingExtensions.GetOutputName(outputAsNewRelicProperty); return(this); }