Template App 0.0.1
Template App Description
Loading...
Searching...
No Matches
Util.Logger Class Reference

Class for logging messages to a file. More...

Public Member Functions

 Logger (string filename, bool toFile=true)
 Logger constructor.
 
void info (string info, bool writeToConsole=true)
 Log information.
 
void info (string info, ConsoleColor color)
 Log information and print to stdout with specified color.
 
void warning (string warning, bool writeToConsole=true)
 Log warning.
 
void error (string error, bool writeToConsole=true)
 Log error.
 
void success (string success, bool writeToConsole=true)
 Log success.
 
void dispose ()
 Close and flush the logger.
 

Public Attributes

bool logToFile = false
 If messages should be written to file or only printed to stdout.
 

Detailed Description

Class for logging messages to a file.

Definition at line 8 of file Logger.cs.

Constructor & Destructor Documentation

◆ Logger()

Util.Logger.Logger ( string filename,
bool toFile = true )

Logger constructor.

Parameters
filenameThe log filename.
toFileIf messages should be written to file or only printed to stdout.

Definition at line 20 of file Logger.cs.

Member Function Documentation

◆ dispose()

void Util.Logger.dispose ( )

Close and flush the logger.

Definition at line 107 of file Logger.cs.

◆ error()

void Util.Logger.error ( string error,
bool writeToConsole = true )

Log error.

Parameters
errorThe error message to be logged.
writeToConsoleIf the message should be printed to stdout or not.

Definition at line 77 of file Logger.cs.

◆ info() [1/2]

void Util.Logger.info ( string info,
bool writeToConsole = true )

Log information.

Parameters
infoThe information message to be logged.
writeToConsoleIf the message should be printed to stdout or not.

Definition at line 34 of file Logger.cs.

◆ info() [2/2]

void Util.Logger.info ( string info,
ConsoleColor color )

Log information and print to stdout with specified color.

Parameters
infoThe information message to be logged.
colorThe foreground color to be used for stdout (if supported).

Definition at line 48 of file Logger.cs.

◆ success()

void Util.Logger.success ( string success,
bool writeToConsole = true )

Log success.

Parameters
successThe success message to be logged.
writeToConsoleIf the message should be printed to stdout or not.

Definition at line 93 of file Logger.cs.

◆ warning()

void Util.Logger.warning ( string warning,
bool writeToConsole = true )

Log warning.

Parameters
warningThe warning message to be logged.
writeToConsoleIf the message should be printed to stdout or not.

Definition at line 61 of file Logger.cs.

Member Data Documentation

◆ logToFile

bool Util.Logger.logToFile = false

If messages should be written to file or only printed to stdout.

Definition at line 13 of file Logger.cs.


The documentation for this class was generated from the following file: