An option to create FileLogger
directory if it is non-existent.
This Logger
implementation writes log messages to the associated file. The name of the file has to be passed on construction time. If the file is already present new log messages will be append at its end.
A constructor for the FileLogger
Logger.
string fn
| The filename of the output file of the FileLogger . If that file can not be opened for writting an exception will be thrown. |
LogLevel lv
| The LogLevel for the FileLogger . By default the |
auto l1 = new FileLogger("logFile"); auto l2 = new FileLogger("logFile", LogLevel.fatal); auto l3 = new FileLogger("logFile", LogLevel.fatal, CreateFolder.yes);
A constructor for the FileLogger
Logger that takes a reference to a File
.
The File
passed must be open for all the log call to the FileLogger
. If the File
gets closed, using the FileLogger
for logging will result in undefined behaviour.
string fn
| The file used for logging. |
LogLevel lv
| The LogLevel for the FileLogger . By default the LogLevel for FileLogger is LogLevel.all . |
CreateFolder createFileNameFolder
| if yes and fn contains a folder name, this folder will be created. |
auto file = File("logFile.log", "w"); auto l1 = new FileLogger(file); auto l2 = new FileLogger(file, LogLevel.fatal);
A constructor for the FileLogger
Logger that takes a reference to a File
.
The File
passed must be open for all the log call to the FileLogger
. If the File
gets closed, using the FileLogger
for logging will result in undefined behaviour.
File file
| The file used for logging. |
LogLevel lv
| The LogLevel for the FileLogger . By default the LogLevel for FileLogger is LogLevel.all . |
auto file = File("logFile.log", "w"); auto l1 = new FileLogger(file); auto l2 = new FileLogger(file, LogLevel.fatal);
If the FileLogger
is managing the File
it logs to, this method will return a reference to this File.
If the FileLogger
was constructed with a filename, this method returns this filename. Otherwise an empty string
is returned.
The File
log messages are written to.
The filename of the File
log messages are written to.
© 1999–2019 The D Language Foundation
Licensed under the Boost License 1.0.
https://dlang.org/phobos/std_experimental_logger_filelogger.html