FileLogger

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.

Constructors

this
this(string fn, LogLevel lv)

A constructor for the FileLogger Logger.

this
this(string fn, LogLevel lv, CreateFolder createFileNameFolder)

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

this
this(File file, LogLevel lv)

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

Members

Functions

getFilename
string getFilename()

If the FileLogger was constructed with a filename, this method returns this filename. Otherwise an empty string is returned.

Properties

file
File file [@property getter]

If the FileLogger is managing the File it logs to, this method will return a reference to this File.

Variables

file_
File file_;

The File log messages are written to.

filename
string filename;

The filename of the File log messages are written to.

Inherited Members

From Logger

LogEntry
struct LogEntry

LogEntry is a aggregation combining all information associated with a log message. This aggregation will be passed to the method writeLogMsg.

writeLogMsg
void writeLogMsg(LogEntry payload)

A custom logger must implement this method in order to work in a MultiLogger and ArrayLogger.

logMsgPart
void logMsgPart(const(char)[] msg)

Logs a part of the log message.

finishLogMsg
void finishLogMsg()

Signals that the message has been written and no more calls to logMsgPart follow.

logLevel
LogLevel logLevel [@property getter]
LogLevel logLevel [@property setter]

The LogLevel determines if the log call are processed or dropped by the Logger. In order for the log call to be processed the LogLevel of the log call must be greater or equal to the LogLevel of the logger.

fatalHandler
void delegate() fatalHandler [@property getter]
void delegate() @(safe) fatalHandler [@property setter]

This delegate is called in case a log message with LogLevel.fatal gets logged.

forwardMsg
void forwardMsg(LogEntry payload)

This method allows forwarding log entries from one logger to another.

memLogFunctions
template memLogFunctions(LogLevel ll)
trace
alias trace = memLogFunctions!(LogLevel.trace).logImpl
tracef
alias tracef = memLogFunctions!(LogLevel.trace).logImplf
info
alias info = memLogFunctions!(LogLevel.info).logImpl
infof
alias infof = memLogFunctions!(LogLevel.info).logImplf
warning
alias warning = memLogFunctions!(LogLevel.warning).logImpl
warningf
alias warningf = memLogFunctions!(LogLevel.warning).logImplf
error
alias error = memLogFunctions!(LogLevel.error).logImpl
errorf
alias errorf = memLogFunctions!(LogLevel.error).logImplf
critical
alias critical = memLogFunctions!(LogLevel.critical).logImpl
criticalf
alias criticalf = memLogFunctions!(LogLevel.critical).logImplf
fatal
alias fatal = memLogFunctions!(LogLevel.fatal).logImpl
fatalf
alias fatalf = memLogFunctions!(LogLevel.fatal).logImplf

This template provides the log functions for the Logger class with the LogLevel encoded in the function name.

log
void log(LogLevel ll, bool condition, A args)
void log(LogLevel ll, bool condition, T args, int line, string file, string funcName, string prettyFuncName)

This method logs data with the LogLevel of the used Logger.

log
void log(LogLevel ll, A args)
void log(LogLevel ll, T args, int line, string file, string funcName, string prettyFuncName, string moduleName)

This function logs data to the used Logger with a specific LogLevel.

log
void log(bool condition, A args)
void log(bool condition, T args, int line, string file, string funcName, string prettyFuncName, string moduleName)

This function logs data to the used Logger depending on a explicitly passed condition with the LogLevel of the used Logger.

log
void log(A args)
void log(T arg, int line, string file, string funcName, string prettyFuncName, string moduleName)

This function logs data to the used Logger with the LogLevel of the used Logger.

logf
void logf(LogLevel ll, bool condition, string msg, A args)

This function logs data to the used Logger with a specific LogLevel and depending on a condition in a printf-style manner.

logf
void logf(LogLevel ll, string msg, A args)

This function logs data to the used Logger with a specific LogLevel in a printf-style manner.

logf
void logf(bool condition, string msg, A args)

This function logs data to the used Logger depending on a condition with the LogLevel of the used Logger in a printf-style manner.

logf
void logf(string msg, A args)

This method logs data to the used Logger with the LogLevel of the this Logger in a printf-style manner.

Meta