Table of Contents

Class UnityLogger

Namespace
Switchboard
Assembly
Switchboard.UnityLogger.dll

An implementation of ILogger that targets the UnityLogHandler.

public sealed class UnityLogger : ILogger
Inheritance
UnityLogger
Implements
Extension Methods

Properties

Default

Gets a static instance of the class.

public static UnityLogger Default { get; }

LogCallerInfo

Gets or sets whether information about the caller of the log method should be displayed.

public bool LogCallerInfo { get; set; }

LogLevel

Gets or sets the minimum level of significance required for a log entry to be processed.

public LogLevel LogLevel { get; set; }

Methods

Log(LogLevel, Exception, ReadOnlySpan<char>)

Logs an exception.

public void Log(LogLevel logLevel, Exception exception, ReadOnlySpan<char> message)

Parameters

logLevel LogLevel

The level of significance assigned to the exception.

exception Exception

The exception to log.

message ReadOnlySpan<char>

A log message to be included with the exception.

Exceptions

ArgumentNullException

Thrown if exception is null.

Log(LogLevel, ReadOnlySpan<char>, string, string, int)

Logs a message.

public void Log(LogLevel logLevel, ReadOnlySpan<char> message, string memberName = null, string filePath = null, int lineNumber = 0)

Parameters

logLevel LogLevel

The level of significance assigned to the message.

message ReadOnlySpan<char>

The log message.

memberName string

The name of the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

filePath string

The name of the file that contains the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.

lineNumber int

The line number within the file that contains the member that called the method. Do not provide an argument. The compiler will automatically assign the correct value.