C# Class WebApplications.Utilities.Logging.Loggers.ConsoleLogger

Inheritance: TextWriterLogger
ファイルを表示 Open project: webappsuk/CoreLibraries

Public Methods

Method Description
Add ( IEnumerable logs, CancellationToken token = newCancellationToken() ) : Task

Adds the specified logs to storage in batches.

ConsoleLogger ( [ name, [ format = null, LoggingLevels validLevels = LoggingLevels.All ) : System

Initializes a new instance of the ConsoleLogger class.

Along with the standard formats supported by the logger, also supports colouration using colour formats.

To change colour use a '+' or '-' followed by a ConsoleColor e.g. {+White}. '+' indicates a foreground colour change, whilst '-' will change the background colour.

The '?' colour will pick a colour based on the current log level, e.g. {+?} for an error will change the foreground colour to red.

The '_' colour will use the current consoles default foreground or background colour (depending on whether it is preceeded with '+' or '-').

Method Details

Add() public method

Adds the specified logs to storage in batches.
public Add ( IEnumerable logs, CancellationToken token = newCancellationToken() ) : Task
logs IEnumerable The logs to add to storage.
token System.Threading.CancellationToken The token.
return Task

ConsoleLogger() public method

Initializes a new instance of the ConsoleLogger class.

Along with the standard formats supported by the logger, also supports colouration using colour formats.

To change colour use a '+' or '-' followed by a ConsoleColor e.g. {+White}. '+' indicates a foreground colour change, whilst '-' will change the background colour.

The '?' colour will pick a colour based on the current log level, e.g. {+?} for an error will change the foreground colour to red.

The '_' colour will use the current consoles default foreground or background colour (depending on whether it is preceeded with '+' or '-').

public ConsoleLogger ( [ name, [ format = null, LoggingLevels validLevels = LoggingLevels.All ) : System
name [ The name.
format [ The format.
validLevels LoggingLevels The valid levels.
return System