Table of Contents

Class TextToken

Namespace
Serilog.Parsing
Assembly
Serilog.dll

A message template token representing literal text.

public sealed class TextToken : MessageTemplateToken
Inheritance
TextToken
Inherited Members

Constructors

TextToken(string)

Construct a TextToken.

public TextToken(string text)

Parameters

text string

The text of the token.

Exceptions

ArgumentNullException

When text is

null

Properties

Length

The token's length.

public override int Length { get; }

Property Value

int

Text

The text of the token.

public string Text { get; }

Property Value

string

Methods

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as a hash function for a particular type.

public override int GetHashCode()

Returns

int

A hash code for the current object.

Render(IReadOnlyDictionary<string, LogEventPropertyValue>, TextWriter, IFormatProvider?)

Render the token to the output.

public override void Render(IReadOnlyDictionary<string, LogEventPropertyValue> properties, TextWriter output, IFormatProvider? formatProvider = null)

Parameters

properties IReadOnlyDictionary<string, LogEventPropertyValue>

Properties that may be represented by the token.

output TextWriter

Output for the rendered string.

formatProvider IFormatProvider

Supplies culture-specific formatting information, or null.

Exceptions

ArgumentNullException

When output is

null

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.