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
			a local clone.
		
	std.experimental.logger.core
- templateisLoggingActiveAt(LogLevel ll)
- This template evaluates if the passed LogLevel is active. The previously described version statements are used to decide if the LogLevel is active. The version statements only influence the compile unit they are used with, therefore this function can only disable logging this specific compile unit.
- enum boolisLoggingActive;
- This compile-time flag istrueif logging is not statically disabled.
- @safe boolisLoggingEnabled()(LogLevelll, LogLevelloggerLL, LogLevelglobalLL, lazy boolcondition= true);
- This 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 associated with a compile unit and can therefore not disable logging in other compile units. pure boolisLoggingEnabled()(LogLevelll) @safe nothrow @nogc
- templatemoduleLogLevel(string moduleName) if (!moduleName.length)
 templatemoduleLogLevel(string moduleName) if (moduleName.length)
- This template returns the LogLevel named "logLevel" of type LogLevel defined in a user defined module where the filename has the suffix "loggerconfig.d". This LogLevel sets the minimal LogLevel of the module.A minimal LogLevel can be defined on a per module basis. In order to define a module LogLevel a file with a modulename "MODULENAME_loggerconfig" must be found. If no such module exists and the module is a nested module, it is checked if there exists a "PARENT_MODULE_loggerconfig" module with such a symbol. If this module exists and it contains a LogLevel called logLevel this LogLevel will be used. This parent lookup is continued until there is no parent module. Then themoduleLogLevelis LogLevel.all.Examples:static assert(moduleLogLevel!"" == LogLevel.all); Examples:static assert(moduleLogLevel!"not.amodule.path" == LogLevel.all); 
- voidlog(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(const LogLevelll, lazy boolcondition, lazy Aargs)
 if (args.length != 1);
 voidlog(T, string moduleName = __MODULE__)(const LogLevelll, lazy boolcondition, lazy Targ, intline= __LINE__, stringfile= __FILE__, stringfuncName= __FUNCTION__, stringprettyFuncName= __PRETTY_FUNCTION__);
- This function logs data.In order for the data to be processed, the LogLevel of thelogcall must be greater or equal to the LogLevel of the sharedLog and the defaultLogLevel; additionally theconditionpassed must betrue.Parameters:LogLevel llThe LogLevel used by this logcall.bool conditionThe conditionmust betruefor the data to be logged.A argsThe data that should be logged. Example: log(LogLevel.warning, true, "Hello World", 3.1415); 
- voidlog(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(const LogLevelll, lazy Aargs)
 if (args.length > 1 && !is(Unqual!(A[0]) : bool));
 voidlog(T, string moduleName = __MODULE__)(const LogLevelll, lazy Targ, intline= __LINE__, stringfile= __FILE__, stringfuncName= __FUNCTION__, stringprettyFuncName= __PRETTY_FUNCTION__);
- This function logs data.In order for the data to be processed the LogLevel of thelogcall must be greater or equal to the LogLevel of the sharedLog.Parameters:LogLevel llThe LogLevel used by this logcall.A argsThe data that should be logged. Example: log(LogLevel.warning, "Hello World", 3.1415); 
- voidlog(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy boolcondition, lazy Aargs)
 if (args.length != 1);
 voidlog(T, string moduleName = __MODULE__)(lazy boolcondition, lazy Targ, intline= __LINE__, stringfile= __FILE__, stringfuncName= __FUNCTION__, stringprettyFuncName= __PRETTY_FUNCTION__);
- This function logs data.In order for the data to be processed the LogLevel of the sharedLog must be greater or equal to the defaultLogLevel add theconditionpassed must betrue.Parameters:bool conditionThe conditionmust betruefor the data to be logged.A argsThe data that should be logged. Example: log(true, "Hello World", 3.1415); 
- voidlog(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy Aargs)
 if (args.length > 1 && !is(Unqual!(A[0]) : bool) && !is(Unqual!(A[0]) == LogLevel) ||args.length == 0);
- This function logs data.In order for the data to be processed the LogLevel of the sharedLog must be greater or equal to the defaultLogLevel.Parameters:A argsThe data that should be logged. Example: log("Hello World", 3.1415); 
- voidlogf(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(const LogLevelll, lazy boolcondition, lazy stringmsg, lazy Aargs);
- This function logs data in a printf-style manner.In order for the data to be processed the LogLevel of the log call must be greater or equal to the LogLevel of the sharedLog and the defaultLogLevel additionally theconditionpassed must betrue.Parameters:LogLevel llThe LogLevel used by this log call. bool conditionThe conditionmust betruefor the data to be logged.string msgThe printf-style string. A argsThe data that should be logged. Example: logf(LogLevel.warning, true, "Hello World %f", 3.1415); 
- voidlogf(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(const LogLevelll, lazy stringmsg, lazy Aargs);
- This function logs data in a printf-style manner.In order for the data to be processed the LogLevel of the log call must be greater or equal to the LogLevel of the sharedLog and the defaultLogLevel.Parameters:LogLevel llThe LogLevel used by this log call. string msgThe printf-style string. A argsThe data that should be logged. Example: logf(LogLevel.warning, "Hello World %f", 3.1415); 
- voidlogf(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy boolcondition, lazy stringmsg, lazy Aargs);
- This function logs data in a printf-style manner.In order for the data to be processed the LogLevel of the log call must be greater or equal to the defaultLogLevel additionally theconditionpassed must betrue.Parameters:bool conditionThe conditionmust betruefor the data to be logged.string msgThe printf-style string. A argsThe data that should be logged. Example: logf(true, "Hello World %f", 3.1415); 
- voidlogf(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy stringmsg, lazy Aargs);
- This function logs data in a printf-style manner.In order for the data to be processed the LogLevel of the log call must be greater or equal to the defaultLogLevel.Parameters:string msgThe printf-style string. A argsThe data that should be logged. Example: logf("Hello World %f", 3.1415); 
- templatedefaultLogFunction(LogLevel ll)
- 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.
- aliastrace= defaultLogFunction!cast(LogLevel)cast(ubyte)32u.defaultLogFunction(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy A args) if (args.length > 0 && !is(Unqual!(A[0]) : bool) || args.length == 0);
 aliasinfo= defaultLogFunction!cast(LogLevel)cast(ubyte)64u.defaultLogFunction(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy A args) if (args.length > 0 && !is(Unqual!(A[0]) : bool) || args.length == 0);
 aliaswarning= defaultLogFunction!cast(LogLevel)cast(ubyte)96u.defaultLogFunction(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy A args) if (args.length > 0 && !is(Unqual!(A[0]) : bool) || args.length == 0);
 aliaserror= defaultLogFunction!cast(LogLevel)cast(ubyte)128u.defaultLogFunction(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy A args) if (args.length > 0 && !is(Unqual!(A[0]) : bool) || args.length == 0);
 aliascritical= defaultLogFunction!cast(LogLevel)cast(ubyte)160u.defaultLogFunction(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy A args) if (args.length > 0 && !is(Unqual!(A[0]) : bool) || args.length == 0);
 aliasfatal= defaultLogFunction!cast(LogLevel)cast(ubyte)192u.defaultLogFunction(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy A args) if (args.length > 0 && !is(Unqual!(A[0]) : bool) || args.length == 0);
- 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 totrue.Parameters:bool condition The condition must be truefor the data to be logged.A 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"); 
- templatedefaultLogFunctionf(LogLevel ll)
- 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.
- aliastracef= defaultLogFunctionf!cast(LogLevel)cast(ubyte)32u.defaultLogFunctionf(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy string msg, lazy A args);
 aliasinfof= defaultLogFunctionf!cast(LogLevel)cast(ubyte)64u.defaultLogFunctionf(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy string msg, lazy A args);
 aliaswarningf= defaultLogFunctionf!cast(LogLevel)cast(ubyte)96u.defaultLogFunctionf(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy string msg, lazy A args);
 aliaserrorf= defaultLogFunctionf!cast(LogLevel)cast(ubyte)128u.defaultLogFunctionf(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy string msg, lazy A args);
 aliascriticalf= defaultLogFunctionf!cast(LogLevel)cast(ubyte)160u.defaultLogFunctionf(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy string msg, lazy A args);
 aliasfatalf= defaultLogFunctionf!cast(LogLevel)cast(ubyte)192u.defaultLogFunctionf(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 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:string msg The printf-style string. A 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.Parameters:bool condition The condition must be truefor the data to be logged.string msg The printf-style string. A 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); 
- enumLogLevel: ubyte;
- There are eight usable logging level. These level are all, trace, info, warning, error, critical, fatal, and off. If a log function withLogLevel.fatal is called the shutdown handler of that logger is called.- all
- Lowest possible assignable LogLevel.
- trace
- LogLevel for tracing the execution of the program.
- info
- This level is used to display information about the program.
- warning
- warnings about the program should be displayed with this level.
- error
- Information about errors should be logged with this level.
- critical
- Messages that inform aboutcriticalerrors should be logged with this level.
- fatal
- Log messages that describefatalerrors should use this level.
- off
- Highest possible LogLevel.
 
- abstract classLogger;
- 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.- structLogEntry;
- LogEntryis a aggregation combining all information associated with a log message. This aggregation will be passed to the method writeLogMsg.- stringfile;
- the filename the log function was called from
- intline;
- thelinenumber the log function was called from
- stringfuncName;
- the name of the function the log function was called from
- stringprettyFuncName;
- the pretty formatted name of the function the log function was called from
- stringmoduleName;
- the name of the module the log message is coming from
- LogLevellogLevel;
- the LogLevel associated with the log message
- TidthreadId;
- thread id of the log message
- SysTimetimestamp;
- the time the message was logged
- stringmsg;
- the message of the log message
- Loggerlogger;
- A refernce to the Logger used to create this LogEntry
 
- @safe this(LogLevellv);
- This constructor takes a name of type string, and a LogLevel.Every subclass of Logger has to call this constructor from their constructor. It sets the LogLevel, the name of the Logger, and creates a fatal handler. The fatal handler will throw an Error if a log call is made with a LogLevel LogLevel.fatal.
- protected abstract @safe voidwriteLogMsg(ref LogEntrypayload);
- A custom logger must implement this method in order to work in a MultiLogger and ArrayLogger.Parameters:LogEntry payloadAll information associated with call to log function. See Also:beginLogMsg, logMsgPart, finishLogMsg
- protected @safe voidlogMsgPart(const(char)[]msg);
- Logs a part of the log message.
- protected @safe voidfinishLogMsg();
- Signals that the message has been written and no more calls to logMsgPart follow.
- final const pure @nogc @property @safe LogLevellogLevel();
 final @nogc @property @safe voidlogLevel(const LogLevellv);
- 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.These two methods set and get the LogLevel of the used Logger.Example: auto f = new FileLogger(stdout); f.logLevel = LogLevel.info; assert(f.logLevel == LogLevel.info); 
- final @nogc @property @safe void delegate()fatalHandler();
 final @nogc @property @safe voidfatalHandler(void delegate() @safefh);
- This delegate is called in case a log message with LogLevel.fatal gets logged.By default an Error will be thrown.
- @trusted voidforwardMsg(ref LogEntrypayload);
- This method allows forwarding log entries from one logger to another.forwardMsgwill ensure proper synchronization and then call writeLogMsg. This is an API for implementing your own loggers and should not be called by normal user code. A notable difference from other logging functions is that the globalLogLevel wont be evaluated again since it is assumed that the caller already checked that.
- templatememLogFunctions(LogLevel ll)
 aliastrace= .Logger.memLogFunctions!cast(LogLevel)cast(ubyte)32u.logImpl(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy A args) if (args.length == 0 || args.length > 0 && !is(A[0] : bool));
 aliastracef= .Logger.memLogFunctions!cast(LogLevel)cast(ubyte)32u.logImplf(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);
 aliasinfo= .Logger.memLogFunctions!cast(LogLevel)cast(ubyte)64u.logImpl(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy A args) if (args.length == 0 || args.length > 0 && !is(A[0] : bool));
 aliasinfof= .Logger.memLogFunctions!cast(LogLevel)cast(ubyte)64u.logImplf(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);
 aliaswarning= .Logger.memLogFunctions!cast(LogLevel)cast(ubyte)96u.logImpl(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy A args) if (args.length == 0 || args.length > 0 && !is(A[0] : bool));
 aliaswarningf= .Logger.memLogFunctions!cast(LogLevel)cast(ubyte)96u.logImplf(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);
 aliaserror= .Logger.memLogFunctions!cast(LogLevel)cast(ubyte)128u.logImpl(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy A args) if (args.length == 0 || args.length > 0 && !is(A[0] : bool));
 aliaserrorf= .Logger.memLogFunctions!cast(LogLevel)cast(ubyte)128u.logImplf(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);
 aliascritical= .Logger.memLogFunctions!cast(LogLevel)cast(ubyte)160u.logImpl(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy A args) if (args.length == 0 || args.length > 0 && !is(A[0] : bool));
 aliascriticalf= .Logger.memLogFunctions!cast(LogLevel)cast(ubyte)160u.logImplf(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);
 aliasfatal= .Logger.memLogFunctions!cast(LogLevel)cast(ubyte)192u.logImpl(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy A args) if (args.length == 0 || args.length > 0 && !is(A[0] : bool));
 aliasfatalf= .Logger.memLogFunctions!cast(LogLevel)cast(ubyte)192u.logImplf(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 template provides the log functions for the Logger class with the LogLevel encoded in the function name.For further information see the the two functions defined inside of this template. The aliases following this template create the public names of these log functions.- voidlogImpl(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy Aargs)
 if (args.length == 0 ||args.length > 0 && !is(A[0] : bool));
- This function logs data to the used Logger.In order for the resulting log message to be logged the LogLevel must be greater or equal than the LogLevel of the used Logger and must be greater or equal than the global LogLevel.Parameters:A argsThe data that should be logged. Example: auto s = new FileLogger(stdout); s.trace(1337, "is number"); s.info(1337, "is number"); s.error(1337, "is number"); s.critical(1337, "is number"); s.fatal(1337, "is number"); 
- voidlogImpl(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy boolcondition, lazy Aargs);
- This function logs data to the used Logger depending on acondition.In order for the resulting log message to be logged the LogLevel must be greater or equal than the LogLevel of the used Logger and must be greater or equal than the global LogLevel additionally theconditionpassed must betrue.Parameters:bool conditionThe conditionmust betruefor the data to be logged.A argsThe data that should be logged. Example: auto s = new FileLogger(stdout); s.trace(true, 1337, "is number"); s.info(false, 1337, "is number"); s.error(true, 1337, "is number"); s.critical(false, 1337, "is number"); s.fatal(true, 1337, "is number"); 
- voidlogImplf(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy boolcondition, lazy stringmsg, lazy Aargs);
- This function logs data to the used Logger 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 used Logger and must be greater or equal than the global LogLevel additionally the passedconditionmust betrue.Parameters:bool conditionThe conditionmust betruefor the data to be logged.string msgThe printf-style string. A argsThe data that should be logged. Example: auto s = new FileLogger(stderr); s.tracef(true, "is number %d", 1); s.infof(true, "is number %d", 2); s.errorf(false, "is number %d", 3); s.criticalf(someFunc(), "is number %d", 4); s.fatalf(true, "is number %d", 5); 
- voidlogImplf(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy stringmsg, lazy Aargs);
- This function logs data to the used Logger 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 used Logger and must be greater or equal than the global LogLevel.Parameters:string msgThe printf-style string. A argsThe data that should be logged. Example: auto s = new FileLogger(stderr); s.tracef("is number %d", 1); s.infof("is number %d", 2); s.errorf("is number %d", 3); s.criticalf("is number %d", 4); s.fatalf("is number %d", 5); 
 
- voidlog(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(const LogLevelll, lazy boolcondition, lazy Aargs)
 if (args.length != 1);
 voidlog(T, string moduleName = __MODULE__)(const LogLevelll, lazy boolcondition, lazy Targs, intline= __LINE__, stringfile= __FILE__, stringfuncName= __FUNCTION__, stringprettyFuncName= __PRETTY_FUNCTION__);
- This method logs data with the LogLevel of the used Logger.This method takes a bool as first argument. In order for the data to be processed the bool must betrueand the LogLevel of the Logger must be greater or equal to the global LogLevel.Parameters:A argsThe data that should be logged. bool conditionThe conditionmust betruefor the data to be logged.A argsThe data that is to be logged. Returns:The logger used by the logging function as reference.Example: auto l = new StdioLogger(); l.log(1337); 
- voidlog(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(const LogLevelll, lazy Aargs)
 if (args.length > 1 && !is(Unqual!(A[0]) : bool) ||args.length == 0);
 voidlog(T)(const LogLevelll, lazy Targs, intline= __LINE__, stringfile= __FILE__, stringfuncName= __FUNCTION__, stringprettyFuncName= __PRETTY_FUNCTION__, stringmoduleName= __MODULE__);
- This function logs data to the used Logger with a specific LogLevel.In order for the resultinglogmessage to be logged the LogLevel must be greater or equal than the LogLevel of the used Logger and must be greater or equal than the global LogLevel.Parameters:LogLevel llThe specific LogLevel used for logging the logmessage.A argsThe data that should be logged. Example: auto s = new FileLogger(stdout); s.log(LogLevel.trace, 1337, "is number"); s.log(LogLevel.info, 1337, "is number"); s.log(LogLevel.warning, 1337, "is number"); s.log(LogLevel.error, 1337, "is number"); s.log(LogLevel.fatal, 1337, "is number"); 
- voidlog(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy boolcondition, lazy Aargs)
 if (args.length != 1);
 voidlog(T)(lazy boolcondition, lazy Targs, intline= __LINE__, stringfile= __FILE__, stringfuncName= __FUNCTION__, stringprettyFuncName= __PRETTY_FUNCTION__, stringmoduleName= __MODULE__);
- This function logs data to the used Logger depending on a explicitly passedconditionwith the LogLevel of the used Logger.In order for the resultinglogmessage to be logged the LogLevel of the used Logger must be greater or equal than the global LogLevel and theconditionmust betrue.Parameters:bool conditionThe conditionmust betruefor the data to be logged.A argsThe data that should be logged. Example: auto s = new FileLogger(stdout); s.log(true, 1337, "is number"); s.log(true, 1337, "is number"); s.log(true, 1337, "is number"); s.log(false, 1337, "is number"); s.log(false, 1337, "is number"); 
- voidlog(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy Aargs)
 if (args.length > 1 && !is(Unqual!(A[0]) : bool) && !is(Unqual!(A[0]) == LogLevel) ||args.length == 0);
 voidlog(T)(lazy Targ, intline= __LINE__, stringfile= __FILE__, stringfuncName= __FUNCTION__, stringprettyFuncName= __PRETTY_FUNCTION__, stringmoduleName= __MODULE__);
- This function logs data to the used Logger with the LogLevel of the used Logger.In order for the resultinglogmessage to be logged the LogLevel of the used Logger must be greater or equal than the global LogLevel.Parameters:A argsThe data that should be logged. Example: auto s = new FileLogger(stdout); s.log(1337, "is number"); s.log(info, 1337, "is number"); s.log(1337, "is number"); s.log(1337, "is number"); s.log(1337, "is number"); 
- voidlogf(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(const LogLevelll, lazy boolcondition, lazy stringmsg, lazy Aargs);
- This function logs data to the used Logger with a specific LogLevel and depending on aconditionin 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 used Logger and must be greater or equal than the global LogLevel and theconditionmust betrue.Parameters:LogLevel llThe specific LogLevel used for logging the log message. bool conditionThe conditionmust betruefor the data to be logged.string msgThe format string used for this log call. A argsThe data that should be logged. Example: auto s = new FileLogger(stdout); s.logf(LogLevel.trace, true ,"%d %s", 1337, "is number"); s.logf(LogLevel.info, true ,"%d %s", 1337, "is number"); s.logf(LogLevel.warning, true ,"%d %s", 1337, "is number"); s.logf(LogLevel.error, false ,"%d %s", 1337, "is number"); s.logf(LogLevel.fatal, true ,"%d %s", 1337, "is number"); 
- voidlogf(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(const LogLevelll, lazy stringmsg, lazy Aargs);
- This function logs data to the used Logger with a specific LogLevel 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 used Logger and must be greater or equal than the global LogLevel.Parameters:LogLevel llThe specific LogLevel used for logging the log message. string msgThe format string used for this log call. A argsThe data that should be logged. Example: auto s = new FileLogger(stdout); s.logf(LogLevel.trace, "%d %s", 1337, "is number"); s.logf(LogLevel.info, "%d %s", 1337, "is number"); s.logf(LogLevel.warning, "%d %s", 1337, "is number"); s.logf(LogLevel.error, "%d %s", 1337, "is number"); s.logf(LogLevel.fatal, "%d %s", 1337, "is number"); 
- voidlogf(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy boolcondition, lazy stringmsg, lazy Aargs);
- This function logs data to the used Logger depending on aconditionwith the LogLevel of the used Logger in a printf-style manner.In order for the resulting log message to be logged the LogLevel of the used Logger must be greater or equal than the global LogLevel and theconditionmust betrue.Parameters:bool conditionThe conditionmust betruefor the data to be logged.string msgThe format string used for this log call. A argsThe data that should be logged. Example: auto s = new FileLogger(stdout); s.logf(true ,"%d %s", 1337, "is number"); s.logf(true ,"%d %s", 1337, "is number"); s.logf(true ,"%d %s", 1337, "is number"); s.logf(false ,"%d %s", 1337, "is number"); s.logf(true ,"%d %s", 1337, "is number"); 
- voidlogf(int line = __LINE__, string file = __FILE__, string funcName = __FUNCTION__, string prettyFuncName = __PRETTY_FUNCTION__, string moduleName = __MODULE__, A...)(lazy stringmsg, lazy Aargs);
- This method logs data to the used Logger with the LogLevel of the this Logger in a printf-style manner.In order for the data to be processed the LogLevel of the Logger must be greater or equal to the global LogLevel.Parameters:string msgThe format string used for this log call. A argsThe data that should be logged. Example: auto s = new FileLogger(stdout); s.logf("%d %s", 1337, "is number"); s.logf("%d %s", 1337, "is number"); s.logf("%d %s", 1337, "is number"); s.logf("%d %s", 1337, "is number"); s.logf("%d %s", 1337, "is number"); 
 
- @property @safe LoggersharedLog();
 @property @trusted voidsharedLog(Loggerlogger);
- This property sets and gets the default Logger.Example: sharedLog = new FileLogger(yourFile); The example sets a new FileLogger as newsharedLog. If at some point you want to use the original defaultloggeragain, you can usesharedLog=null;. This will put back the original.Note: While getting and setting sharedLogis thread-safe, it has to be considered that the returned reference is only a current snapshot and in the following code, you must make sure no other thread reassigns to it between reading and writingsharedLog.if (sharedLog !is myLogger) sharedLog = new myLogger; 
- @nogc @property @safe LogLevelglobalLogLevel();
 @property @safe voidglobalLogLevel(LogLevelll);
- This methods get and set the global LogLevel.Every log message with a LogLevel lower as the global LogLevel will be discarded before it reaches writeLogMessage method of any Logger.
- classStdForwardLogger: std.experimental.logger.core.Logger;
- TheStdForwardLoggerwill always forward anything to the sharedLog.TheStdForwardLoggerwill not throw if data is logged with LogLevel.fatal.Examples:auto nl1 = new StdForwardLogger(LogLevel.all); - @safe this(const LogLevellv= LogLevel.all);
- The default constructor for the StdForwardLogger.Parameters:LogLevel lvThe LogLevel for the MultiLogger. By default the LogLevel is all. 
 
- @property @safe LoggerstdThreadLocalLog();
 @property @safe voidstdThreadLocalLog(Loggerlogger);
- This function returns a thread unique Logger, that by default propergates all data logged to it to the sharedLog.These properties can be used to set and get this Logger. Every modification to this Logger will only be visible in the thread the modification has been done from. This Logger is called by the free standing log functions. This allows to create thread local redirections and still use the free standing log functions.Examples:Dittoimport std.experimental.logger.filelogger : FileLogger; import std.file : deleteme, remove; Logger l = stdThreadLocalLog; stdThreadLocalLog = new FileLogger(deleteme ~ "-someFile.log"); scope(exit) remove(deleteme ~ "-someFile.log"); auto tempLog = stdThreadLocalLog; stdThreadLocalLog = l; destroy(tempLog); 
Copyright © 1999-2017 by the D Language Foundation | Page generated by
Ddoc on (no date time)