View source code
Display the source code in std/logger/filelogger.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

std.logger.filelogger.FileLogger.this - multiple declarations

Function FileLogger.this

A constructor for the FileLogger Logger.

this (
  const(string) fn,
  const(LogLevel) lv = LogLevel.all
) @safe;

Parameters

NameDescription
fn The filename of the output file of the FileLogger. If that file can not be opened for writting an exception will be thrown.
lv The LogLevel for the FileLogger. By default the

Example

auto l1 = new FileLogger("logFile");
auto l2 = new FileLogger("logFile", LogLevel.fatal);
auto l3 = new FileLogger("logFile", LogLevel.fatal, CreateFolder.yes);

Function FileLogger.this

A constructor for the FileLogger Logger that takes a reference to a File.

this (
  const(string) fn,
  const(LogLevel) lv,
  Flag!("CreateFolder") createFileNameFolder
) @safe;

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.

Parameters

NameDescription
fn The file used for logging.
lv The LogLevel for the FileLogger. By default the LogLevel for FileLogger is LogLevel.all.
createFileNameFolder if yes and fn contains a folder name, this folder will be created.

Example

auto file = File("logFile.log", "w");
auto l1 = new FileLogger(file);
auto l2 = new FileLogger(file, LogLevel.fatal);

Function FileLogger.this

A constructor for the FileLogger Logger that takes a reference to a File.

this (
  File file,
  const(LogLevel) lv = LogLevel.all
) @safe;

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.

Parameters

NameDescription
file The file used for logging.
lv The LogLevel for the FileLogger. By default the LogLevel for FileLogger is LogLevel.all.

Example

auto file = File("logFile.log", "w");
auto l1 = new FileLogger(file);
auto l2 = new FileLogger(file, LogLevel.fatal);

Authors

License