View source code
Display the source code in std/logger/core.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.core.Logger.logf - multiple declarations

Function Logger.logf

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 bool condition,
  lazy string msg,
  lazy A args
);

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 the condition must be true.

Parameters

NameDescription
ll The specific LogLevel used for logging the log message.
condition The condition must be true for the data to be logged.
msg The format string used for this log call.
args The 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");

Function Logger.logf

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...) (
  const LogLevel ll,
  lazy string msg,
  lazy A args
);

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

NameDescription
ll The specific LogLevel used for logging the log message.
msg The format string used for this log call.
args The 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");

Function Logger.logf

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 bool condition,
  lazy string msg,
  lazy A args
);

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 the condition must be true.

Parameters

NameDescription
condition The condition must be true for the data to be logged.
msg The format string used for this log call.
args The 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");

Function Logger.logf

This method logs data to the used Logger with the LogLevel of the this 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
);

In order for the data to be processed the LogLevel of the Logger must be greater or equal to the global LogLevel.

Parameters

NameDescription
msg The format string used for this log call.
args The 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");

Authors

License