C# Class Serilog.Formatting.Json.JsonFormatter

Formats log events in a simple JSON structure. Instances of this class are safe for concurrent access by multiple threads.
Inheritance: ITextFormatter
Show file Open project: serilog/serilog Class Usage Examples

Public Methods

Method Description
Format ( LogEvent logEvent, TextWriter output ) : void

Format the log event into the output.

JsonFormatter ( string closingDelimiter = null, bool renderMessage = false, IFormatProvider formatProvider = null ) : System

Construct a JsonFormatter.

Private Methods

Method Description
AddLiteralWriter ( Type type, TextWriter>.Action writer ) : void
Escape ( string s ) : string
JsonFormatter ( bool omitEnclosingObject, string closingDelimiter = null, bool renderMessage = false, IFormatProvider formatProvider = null ) : System
WriteBoolean ( bool value, TextWriter output ) : void
WriteDateTime ( System.DateTime value, TextWriter output ) : void
WriteDictionary ( LogEventPropertyValue>.IReadOnlyDictionary elements, TextWriter output ) : void
WriteDouble ( double value, TextWriter output ) : void
WriteException ( Exception exception, string &delim, TextWriter output ) : void
WriteJsonProperty ( string name, object value, string &precedingDelimiter, TextWriter output ) : void
WriteLevel ( LogEventLevel level, string &delim, TextWriter output ) : void
WriteLiteral ( object value, TextWriter output, bool forceQuotation = false ) : void
WriteLiteralValue ( object value, TextWriter output ) : void
WriteMessageTemplate ( string template, string &delim, TextWriter output ) : void
WriteOffset ( DateTimeOffset value, TextWriter output ) : void
WriteProperties ( LogEventPropertyValue>.IReadOnlyDictionary properties, TextWriter output ) : void
WritePropertiesValues ( LogEventPropertyValue>.IReadOnlyDictionary properties, TextWriter output ) : void
WriteRenderedMessage ( string message, string &delim, TextWriter output ) : void
WriteRenderings ( PropertyToken>.IGrouping tokensWithFormat, LogEventPropertyValue>.IReadOnlyDictionary properties, TextWriter output ) : void
WriteRenderingsValues ( PropertyToken>.IGrouping tokensWithFormat, LogEventPropertyValue>.IReadOnlyDictionary properties, TextWriter output ) : void
WriteSequence ( IEnumerable elements, TextWriter output ) : void
WriteSingle ( float value, TextWriter output ) : void
WriteString ( string value, TextWriter output ) : void
WriteStructure ( string typeTag, IEnumerable properties, TextWriter output ) : void
WriteTimestamp ( DateTimeOffset timestamp, string &delim, TextWriter output ) : void
WriteToString ( object number, bool quote, TextWriter output ) : void

Method Details

Format() public method

Format the log event into the output.
public Format ( LogEvent logEvent, TextWriter output ) : void
logEvent Serilog.Events.LogEvent The event to format.
output System.IO.TextWriter The output.
return void

JsonFormatter() public method

Construct a JsonFormatter.
public JsonFormatter ( string closingDelimiter = null, bool renderMessage = false, IFormatProvider formatProvider = null ) : System
closingDelimiter string A string that will be written after each log event is formatted. /// If null, will be used.
renderMessage bool If true, the message will be rendered and written to the output as a /// property named RenderedMessage.
formatProvider IFormatProvider Supplies culture-specific formatting information, or null.
return System