My Project
|
Provides a set of methods and properties for logging. More...
Public Member Functions | |
Logger () | |
Initializes a new instance of the Logger class. | |
Logger (LogLevel level) | |
Initializes a new instance of the Logger class with the specified logging level. | |
Logger (LogLevel level, string file, Action< LogData, string > output) | |
Initializes a new instance of the Logger class with the specified logging level, path to the log file, and delegate used to output a log. | |
void | Debug (string message) |
Outputs the specified message as a log with the Debug level. | |
void | Error (string message) |
Outputs the specified message as a log with the Error level. | |
void | Fatal (string message) |
Outputs the specified message as a log with the Fatal level. | |
void | Info (string message) |
Outputs the specified message as a log with the Info level. | |
void | Trace (string message) |
Outputs the specified message as a log with the Trace level. | |
void | Warn (string message) |
Outputs the specified message as a log with the Warn level. | |
Properties | |
string | File [get, set] |
Gets or sets the path to the log file. | |
LogLevel | Level [get, set] |
Gets or sets the current logging level. | |
Action< LogData, string > | Output [get, set] |
Gets or sets the delegate used to output a log. | |
Provides a set of methods and properties for logging.
If you output a log with lower than the current logging level, it cannot be outputted.
The default output method writes a log to the standard output stream and the text file if it has a valid path.
If you would like to use the custom output method, you should specify it with the constructor or the Logger.Output property.
|
inline |
Initializes a new instance of the Logger class.
This constructor initializes the logging level with the Error level.
|
inline |
Initializes a new instance of the Logger class with the specified logging level.
level | One of the LogLevel enum values that specifies the logging level. |
|
inline |
Initializes a new instance of the Logger class with the specified logging level, path to the log file, and delegate used to output a log.
level | One of the LogLevel enum values that specifies the logging level. |
file | A string that specifies the path to the log file. |
output | An T:System.Action<LogData, string> that specifies the delegate used to output a log. |
|
inline |
Outputs the specified message as a log with the Debug level.
If the current logging level is higher than the Debug level, this method does not output the message as a log.
message | A string that specifies the message to output. |
|
inline |
Outputs the specified message as a log with the Error level.
If the current logging level is higher than the Error level, this method does not output the message as a log.
message | A string that specifies the message to output. |
|
inline |
Outputs the specified message as a log with the Fatal level.
message | A string that specifies the message to output. |
|
inline |
Outputs the specified message as a log with the Info level.
If the current logging level is higher than the Info level, this method does not output the message as a log.
message | A string that specifies the message to output. |
|
inline |
Outputs the specified message as a log with the Trace level.
If the current logging level is higher than the Trace level, this method does not output the message as a log.
message | A string that specifies the message to output. |
|
inline |
Outputs the specified message as a log with the Warn level.
If the current logging level is higher than the Warn level, this method does not output the message as a log.
message | A string that specifies the message to output. |
|
getset |
Gets or sets the path to the log file.
A string that represents the path to the log file if any.
|
getset |
Gets or sets the current logging level.
A log with lower than the value of this property cannot be outputted.
One of the LogLevel enum values.
It represents the current logging level.
|
getset |
Gets or sets the delegate used to output a log.
An T:System.Action<LogData, string> delegate.
It references the method used to output a log.
The string parameter passed to the delegate is the value of the Logger.File property.
If the value to set is null
, the default output method is set.