Class Logger
Class for message logging
Inherited Members
Namespace: DuetControlServer.Utility
Assembly: DuetControlServer.dll
Syntax
public static class Logger
Fields
DefaultLogFile
Default log file for M929 in case no P parameter is specified
Declaration
public const string DefaultLogFile = "eventlog.txt"
Field Value
Type | Description |
---|---|
string |
Methods
Log(LogLevel, Message)
Write a message including timestamp to the log file
Declaration
public static void Log(LogLevel level, Message message)
Parameters
Type | Name | Description |
---|---|---|
LogLevel | level | Log level of the message |
Message | message | Message to log |
Log(LogLevel, MessageType, string)
Write a message including timestamp to the log file
Declaration
public static void Log(LogLevel level, MessageType type, string content)
Parameters
Type | Name | Description |
---|---|---|
LogLevel | level | Log level |
MessageType | type | Message type |
string | content | Message content |
Log(Message)
Write messages including timestamp to the log file
Declaration
public static void Log(Message message)
Parameters
Type | Name | Description |
---|---|---|
Message | message | Message to log |
Log(MessageType, string)
Write a message including timestamp to the log file
Declaration
public static void Log(MessageType type, string content)
Parameters
Type | Name | Description |
---|---|---|
MessageType | type | Message type |
string | content | Message content |
LogAsync(LogLevel, Message)
Write a message including timestamp to the log file asynchronously
Declaration
public static Task LogAsync(LogLevel level, Message message)
Parameters
Type | Name | Description |
---|---|---|
LogLevel | level | Log level of the message |
Message | message | Message to log |
Returns
Type | Description |
---|---|
Task | Asynchronous task |
LogAsync(LogLevel, MessageType, string)
Write a message including timestamp to the log file asynchronously
Declaration
public static Task LogAsync(LogLevel level, MessageType type, string content)
Parameters
Type | Name | Description |
---|---|---|
LogLevel | level | Log level |
MessageType | type | Message type |
string | content | Message content |
Returns
Type | Description |
---|---|
Task | Asynchronous task |
LogAsync(Message)
Write messages including timestamp to the log file asynchronously
Declaration
public static Task LogAsync(Message message)
Parameters
Type | Name | Description |
---|---|---|
Message | message | Message to log |
Returns
Type | Description |
---|---|
Task | Asynchronous task |
LogAsync(MessageType, string)
Write a message including timestamp to the log file asynchronously
Declaration
public static Task LogAsync(MessageType type, string content)
Parameters
Type | Name | Description |
---|---|---|
MessageType | type | Message type |
string | content | Message content |
Returns
Type | Description |
---|---|
Task | Asynchronous task |
LogOutput(Message)
Log and output a message
Declaration
public static void LogOutput(Message message)
Parameters
Type | Name | Description |
---|---|---|
Message | message | Message to log and output |
LogOutput(MessageType, string)
Log and output a message
Declaration
public static void LogOutput(MessageType type, string content)
Parameters
Type | Name | Description |
---|---|---|
MessageType | type | Message type |
string | content | Message content |
LogOutputAsync(Message)
Log and output a message asynchronously
Declaration
public static Task LogOutputAsync(Message message)
Parameters
Type | Name | Description |
---|---|---|
Message | message | Message to log and output |
Returns
Type | Description |
---|---|
Task | Asynchronous task |
LogOutputAsync(MessageType, string)
Log and output a message
Declaration
public static Task LogOutputAsync(MessageType type, string content)
Parameters
Type | Name | Description |
---|---|---|
MessageType | type | Message type |
string | content | Message content |
Returns
Type | Description |
---|---|
Task | Asynchronous task |
Start(string, LogLevel)
Start logging to a file
Declaration
public static void Start(string filename, LogLevel level)
Parameters
Type | Name | Description |
---|---|---|
string | filename | Filename to write to |
LogLevel | level | Requested log level |
StartAsync(string, LogLevel)
Start logging to a file
Declaration
public static Task StartAsync(string filename, LogLevel level)
Parameters
Type | Name | Description |
---|---|---|
string | filename | Filename to write to |
LogLevel | level | Requested log level |
Returns
Type | Description |
---|---|
Task | Asynchronous task |
Stop()
Stop logging
Declaration
public static void Stop()
StopAsync()
Stop logging asynchronously
Declaration
public static Task StopAsync()
Returns
Type | Description |
---|---|
Task | Asynchronous task |