Table of Contents

Class JsonLogFormatter

Namespace
Microsoft.Practices.EnterpriseLibrary.Logging.Formatters
Assembly
Microsoft.Practices.EnterpriseLibrary.Logging.dll

Represents a log formatter that will format a LogEntry in JSON-compliant format.

public class JsonLogFormatter : LogFormatter, ILogFormatter
Inheritance
JsonLogFormatter
Implements
Inherited Members

Constructors

JsonLogFormatter()

Initializes a new instance of the JsonLogFormatter class.

public JsonLogFormatter()

JsonLogFormatter(JsonFormatting)

Initializes a new instance of the JsonLogFormatter class with the specified formatting options.

public JsonLogFormatter(JsonFormatting formatting)

Parameters

formatting JsonFormatting

The formatting options.

Properties

Formatting

Gets or sets the formatting of the written event.

public JsonFormatting Formatting { get; set; }

Property Value

JsonFormatting

The JsonFormatting value.

Methods

Deserialize<T>(string)

Deserializes the string representation of a LogEntry into a LogEntry instance.

public static T Deserialize<T>(string serializedLogEntry) where T : LogEntry

Parameters

serializedLogEntry string

The serialized LogEntry representation.

Returns

T

The LogEntry.

Type Parameters

T

Format(LogEntry)

Formats a log entry and returns a string to be output.

public override string Format(LogEntry log)

Parameters

log LogEntry

The log entry to format.

Returns

string

A string that represents the log entry.