EGDL2 2.1
|
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 output action. | |
void | Debug (string message) |
Outputs message as a log with LogLevel.Debug. | |
void | Error (string message) |
Outputs message as a log with LogLevel.Error. | |
void | Fatal (string message) |
Outputs message as a log with LogLevel.Fatal. | |
void | Info (string message) |
Outputs message as a log with LogLevel.Info. | |
void | Trace (string message) |
Outputs message as a log with LogLevel.Trace. | |
void | Warn (string message) |
Outputs message as a log with LogLevel.Warn. | |
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 current output action used to output a log. | |
Provides a set of methods and properties for logging.
If you output a log with lower than the Logger.Level, it cannot be outputted.
The default output action writes a log to the standard output stream and the Logger.File if it has a valid path.
If you would like to use the custom output action, you should set the Logger.Output to any Action<LogData, string>
.
|
inline |
Initializes a new instance of the Logger class.
This constructor initializes the current logging level with LogLevel.Error.
|
inline |
Initializes a new instance of the Logger class with the specified logging level .
level | One of the LogLevel enum values. |
|
inline |
Initializes a new instance of the Logger class with the specified logging level , path to the log file , and output action.
level | One of the LogLevel enum values. |
file | A string that represents the path to the log file. |
output | An Action<LogData, string> delegate that references the method(s) used to output a log. A string parameter passed to this delegate is file . |
|
inline |
Outputs message as a log with LogLevel.Debug.
If the current logging level is higher than LogLevel.Debug, this method doesn't output message as a log.
message | A string that represents the message to output as a log. |
|
inline |
Outputs message as a log with LogLevel.Error.
If the current logging level is higher than LogLevel.Error, this method doesn't output message as a log.
message | A string that represents the message to output as a log. |
|
inline |
Outputs message as a log with LogLevel.Fatal.
message | A string that represents the message to output as a log. |
|
inline |
Outputs message as a log with LogLevel.Info.
If the current logging level is higher than LogLevel.Info, this method doesn't output message as a log.
message | A string that represents the message to output as a log. |
|
inline |
Outputs message as a log with LogLevel.Trace.
If the current logging level is higher than LogLevel.Trace, this method doesn't output message as a log.
message | A string that represents the message to output as a log. |
|
inline |
Outputs message as a log with LogLevel.Warn.
If the current logging level is higher than LogLevel.Warn, this method doesn't output message as a log.
message | A string that represents the message to output as a log. |
|
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, indicates the current logging level.
|
getset |
Gets or sets the current output action used to output a log.
An Action<LogData, string>
delegate that references the method(s) used to output a log. A string parameter passed to this delegate is the value of the Logger.File.
If the value to set is null
, the current output action is changed to the default output action.