std.logger.core
Source: std/logger/core.d
Types 17
This function logs data to the stdThreadLocalLog, optionally depending on a condition.
In order for the resulting log message to be logged the LogLevel must be greater or equal than the LogLevel of the stdThreadLocalLog and must be greater or equal than the global LogLevel. Additionally the LogLevel must be greater or equal than the LogLevel of the stdSharedLogger. If a condition is given, it must evaluate to true.
Parameters
condition | The condition must be true for the data to be logged. |
args | The data that should be logged. Example: -------------------- trace(1337, "is number"); info(1337, "is number"); error(1337, "is number"); critical(1337, "is number"); fatal(1337, "is number"); trace(true, 1337, "is number"); info(false, 1337, "is number"); error(true, 1337, "is number"); critical(false, 1337, "is number"); fatal(true, 1337, "is number"); -------------------- |
Ditto
Ditto
Ditto
Ditto
Ditto
This function logs data to the sharedLog in a printf-style manner.
In order for the resulting log message to be logged the LogLevel must be greater or equal than the LogLevel of the sharedLog and must be greater or equal than the global LogLevel. Additionally the LogLevel must be greater or equal than the LogLevel of the stdSharedLogger.
Parameters
msg | The printf-style string. |
args | The data that should be logged. Example: -------------------- tracef("is number %d", 1); infof("is number %d", 2); errorf("is number %d", 3); criticalf("is number %d", 4); fatalf("is number %d", 5); -------------------- The second version of the function logs data to the sharedLog in a printf-style manner. In order for the resulting log message to be logged the LogLevel must be greater or equal than the LogLevel of the sharedLog and must be greater or equal than the global LogLevel. Additionally the LogLevel must be greater or equal than the LogLevel of the stdSharedLogger. |
Params: condition = The condition must be true for the data to be logged. msg = The printf-style string. args = The data that should be logged.
Example: -------------------- tracef(false, "is number %d", 1); infof(false, "is number %d", 2); errorf(true, "is number %d", 3); criticalf(true, "is number %d", 4); fatalf(someFunct(), "is number %d", 5); --------------------
Ditto
Ditto
Ditto
Ditto
Ditto
There are eight usable logging level. These level are all, trace,
info, warning, error, critical, fatal, and off.If a log function with LogLevel.fatal is called the shutdown handler of that logger is called.
This class is the base of every logger. In order to create a new kind of logger a deriving class needs to implement the writeLogMsg method. By default this is not thread-safe.
It is also possible to override the three methods beginLogMsg, logMsgPart and finishLogMsg together, this option gives more flexibility.
private void delegate() @safe fatalHandler_private LogLevel logLevel_private Mutex mutexAppender!string msgAppenderLogEntry headervoid writeLogMsg(ref LogEntry payload) @safeA custom logger must implement this method in order to work in a `MultiLogger` and `ArrayLogger`.void beginLogMsg(string file, int line, string funcName,
string prettyFuncName, string moduleName, LogLevel logLevel,
Tid threadId, SysTime timestamp, Logger logger) @safevoid finishLogMsg() @safeSignals that the message has been written and no more calls to `logMsgPart` follow.LogLevel logLevel() @property const pure @safe @nogcThe `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 `LogLeve...void delegate() fatalHandler() @property @safe @nogcThis `delegate` is called in case a log message with `LogLevel.fatal` gets logged.void forwardMsg(ref LogEntry payload) @trustedThis method allows forwarding log entries from one logger to another.void log(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(const LogLevel ll,
lazy bool condition, lazy A args) if (args.length != 1)This method logs data with the `LogLevel` of the used `Logger`.void log(T, string moduleName = __MODULE__)(const LogLevel ll,
lazy bool condition, lazy T args, int line = __LINE__,
string file = __FILE__, string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__)Dittovoid log(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(const LogLevel ll, lazy A args) if ((args.length > 1 && !is(Unqual!(A[0]) : bool)) || args.length == 0)This function logs data to the used `Logger` with a specific `LogLevel`.void log(T)(const LogLevel ll, lazy T args, int line = __LINE__,
string file = __FILE__, string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__)Dittovoid log(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(lazy bool condition, lazy A args) if (args.length != 1)This function logs data to the used `Logger` depending on a explicitly passed condition with the `LogLevel` of the used `Logger`.void log(T)(lazy bool condition, lazy T args, int line = __LINE__,
string file = __FILE__, string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__)Dittovoid log(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(lazy A args) if ((args.length > 1
&& !is(Unqual!(A[0]) : bool)
&& !is(immutable A[0] == immutable LogLevel))
|| args.length == 0)This function logs data to the used `Logger` with the `LogLevel` of the used `Logger`.void log(T)(lazy T arg, int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__)Dittovoid logf(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(const LogLevel ll,
lazy bool condition, lazy string msg, lazy A args)This function logs data to the used `Logger` with a specific `LogLevel` and depending on a condition in a `printf`-style manner.void logf(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(const LogLevel ll,
lazy string msg, lazy A args)This function logs data to the used `Logger` with a specific `LogLevel` in a `printf`-style manner.void logf(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(lazy bool condition,
lazy string msg, lazy 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.void logf(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(lazy string msg, lazy A args)This method logs data to the used `Logger` with the `LogLevel` of the this `Logger` in a `printf`-style manner.LogEntryLogEntry is a aggregation combining all information associated with a log message. This aggregation will be passed to the method writeLogMsg.memLogFunctions(LogLevel ll)This template provides the log functions for the `Logger` `class` with the `LogLevel` encoded in the function name.The StdForwardLogger will always forward anything to the sharedLog.
The StdForwardLogger will not throw if data is logged with LogLevel.fatal.
void writeLogMsg(ref LogEntry payload) @trustedvoid writeLogMsg(ref LogEntry payload) @safeFunctions 25
bool isLoggingEnabled()(LogLevel ll, LogLevel loggerLL,
LogLevel globalLL, lazy bool condition = true) @safeThis functions is used at runtime to determine if a `LogLevel` is active. The same previously defined version statements are used to disable certain levels. Again the version statements are associa...void systimeToISOString(OutputRange)(OutputRange o, const ref SysTime time) if (isOutputRange!(OutputRange, string))void log(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(const LogLevel ll,
lazy bool condition, lazy A args) if (args.length != 1)This function logs data.void log(T, string moduleName = __MODULE__)(const LogLevel ll,
lazy bool condition, lazy T arg, int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__)Dittovoid log(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(const LogLevel ll, lazy A args) if (args.length > 1 && !is(Unqual!(A[0]) : bool))This function logs data.void log(T, string moduleName = __MODULE__)(const LogLevel ll, lazy T arg,
int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__)Dittovoid log(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(lazy bool condition, lazy A args) if (args.length != 1)This function logs data.void log(T, string moduleName = __MODULE__)(lazy bool condition, lazy T arg,
int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__)Dittovoid log(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(lazy A args) if ((args.length > 1 && !is(Unqual!(A[0]) : bool)
&& !is(Unqual!(A[0]) == LogLevel))
|| args.length == 0)This function logs data.void log(T)(lazy T arg, int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__)void logf(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(const LogLevel ll,
lazy bool condition, lazy string msg, lazy A args)This function logs data in a `printf`-style manner.void logf(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(const LogLevel ll, lazy string msg,
lazy A args)This function logs data in a `printf`-style manner.void logf(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(lazy bool condition,
lazy string msg, lazy A args)This function logs data in a `printf`-style manner.void logf(int line = __LINE__, string file = __FILE__,
string funcName = __FUNCTION__,
string prettyFuncName = __PRETTY_FUNCTION__,
string moduleName = __MODULE__, A...)(lazy string msg, lazy A args)This function logs data in a `printf`-style manner.shared(Logger) sharedLog() @property @safeThis property sets and gets the default `Logger`. Unless set to another logger by the user, the default logger's log level is LogLevel.info.Logger stdThreadLocalLog() @property @safeThis function returns a thread unique `Logger`, that by default propagates all data logged to it to the `sharedLog`.Variables 5
This LogLevel is unqiue to every thread.
The thread local Logger will use this LogLevel to filter log calls every same way as presented earlier.
Templates 2
This template provides the global log functions with the LogLevel is encoded in the function name.
The aliases following this template create the public names of these log functions.
This template provides the global printf-style log functions with the LogLevel is encoded in the function name.
The aliases following this template create the public names of the log functions.