Skip to content

808ffa42 0738 9cb6 b0ab 05a9196526c8

Axel Kesseler edited this page Mar 1, 2023 · 1 revision

GelfFormatter.Format Method

This method formats provided logging event and writes the result back into provided string builder.

Namespace: Plexdata.LogWriter.Internals.Formatters
Assembly: Plexdata.LogWriter.Abstraction (in Plexdata.LogWriter.Abstraction.dll) Version: 1.0.7.1

Syntax

C#

public void Format(
	StringBuilder builder,
	ILogEvent value
)

Parameters

 

builder
Type: System.Text.StringBuilder
The string builder instance that takes the formatted logging event.
value
Type: Plexdata.LogWriter.Abstraction.ILogEvent
The logging event instance to be formatted.

Implements

ILogEventFormatter.Format(StringBuilder, ILogEvent)

Exceptions

 

Exception Condition
ArgumentNullException This exception is thrown as soon as one the parameters is null.

Remarks

The GELF formatter turns parameter value into a valid GELF message consisting at least of fields version, host, short_message and level. Each logging level is converted into its corresponding Syslog Severity Level automatically.

Optional field timestamp can be used by enabling property ShowTime. Indeed, the usage of timestamp at client side is recommended.

Optional field full_message is used as message text only if short_message contains a template. However, a usage of templates is not yet supported. This in turn means that full_message remains empty for the moment.

See Also

Reference

GelfFormatter Class
Plexdata.LogWriter.Internals.Formatters Namespace
ILoggerSettings.ShowKey
ILoggerSettings.ShowTime
DateTimeExtension.ToUnixEpoch(DateTime)
LogLevelExtension.ToUnixSeverityLevel(LogLevel)

Clone this wiki locally