Show / Hide Table of Contents

Class Log

Sends log messages to custom handlers or the console. Additionally writes to Debug, an in-memory buffer and a plain text file.

Inheritance
Object
Log
Namespace: NanoByte.Common
Assembly: NanoByte.Common.dll
Syntax
public static class Log : Object

Properties

Content

Collects all log entries from this application session.

Declaration
public static string Content { get; }
Property Value
Type Description
String

Methods

add_Handler(LogEntryEventHandler)

Declaration
public static void add_Handler(LogEntryEventHandler value)
Parameters
Type Name Description
LogEntryEventHandler value

Debug(String, Exception)

Writes information to help developers diagnose problems to the log.

Declaration
public static void Debug(string message, Exception exception = null)
Parameters
Type Name Description
String message
Exception exception

Error(String, Exception)

Writes a critical error that should be attended to the log.

Declaration
public static void Error(string message, Exception exception = null)
Parameters
Type Name Description
String message
Exception exception

Info(String, Exception)

Writes nice-to-know information to the log.

Declaration
public static void Info(string message, Exception exception = null)
Parameters
Type Name Description
String message
Exception exception

remove_Handler(LogEntryEventHandler)

Declaration
public static void remove_Handler(LogEntryEventHandler value)
Parameters
Type Name Description
LogEntryEventHandler value

Warn(String, Exception)

Writes a warning that doesn't have to be acted upon immediately to the log.

Declaration
public static void Warn(string message, Exception exception = null)
Parameters
Type Name Description
String message
Exception exception

Events

Handler

Invoked when a new entry is added to the log. Only the newest (last) registered handler is invoked. Console output is used as a fallback if no handlers are registered.

Declaration
public static event LogEntryEventHandler Handler
Event Type
Type Description
LogEntryEventHandler
In This Article
Back to top Copyright Bastian Eicher