Table of Contents

Class WarfareLogger

Namespace
Uncreated.Warfare.Logging
Assembly
Uncreated.Warfare.dll
public class WarfareLogger : ILogger
Inheritance
WarfareLogger
Implements
Inherited Members
Extension Methods

Constructors

WarfareLogger(string, WarfareLoggerProvider, ITranslationValueFormatter?)

public WarfareLogger(string categoryName, WarfareLoggerProvider loggerProvider, ITranslationValueFormatter? formatter)

Parameters

categoryName string
loggerProvider WarfareLoggerProvider
formatter ITranslationValueFormatter

Methods

BeginScope<TState>(TState)

Begins a logical operation scope.

[MustUseReturnValue("Must be disposed after use to cancel the scope.")]
public IDisposable BeginScope<TState>(TState state) where TState : notnull

Parameters

state TState

The identifier for the scope.

Returns

IDisposable

An IDisposable that ends the logical operation scope on dispose.

Type Parameters

TState

The type of the state to begin scope for.

CheckForMessageLog(ref LogLevel, ref string)

Removes the value added by ICommandUser to override when Information is disabled.

public static void CheckForMessageLog(ref LogLevel logLevel, ref string message)

Parameters

logLevel LogLevel
message string

IsEnabled(LogLevel)

Checks if the given logLevel is enabled.

[Pure]
public bool IsEnabled(LogLevel logLevel)

Parameters

logLevel LogLevel

Level to be checked.

Returns

bool

true if enabled.

Log<TState>(LogLevel, EventId, TState, Exception?, Func<TState, Exception?, string>)

Writes a log entry.

public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)

Parameters

logLevel LogLevel

Entry will be written on this level.

eventId EventId

Id of the event.

state TState

The entry to be written. Can be also an object.

exception Exception

The exception related to this entry.

formatter Func<TState, Exception, string>

Function to create a string message of the state and exception.

Type Parameters

TState

The type of the object to be written.