generateStyle

Utility mixin template that generates facilities for output message formatting for console output and file output. * Style parameter defines what type is used as logging level. It must be an enum. Order of values defines behavior of muting (styles that less current low border aren't printed to output). * First value of Args could be a function/delegate for customizing time formatting. It should have return type of string and parameters of (DistType t, SysTime time). Where t tells when function/delegate is called to format output to file or console, time is a time that should be converted to string. * Rest part of $(Args) has format of list of triples (Style value, string, string). Style value defines for which logging level following format strings are. First format string is used for console output, the second one is for file output. * Format strings could use two arguments: '%1$s' is message that is passed to a logger and '%2$s' is current time string. Formatting is handled by std.format module.

mixin template generateStyle (
Style
Args...
) {}

Examples

Example of default style

1 import dlogg.log;
2 mixin generateStyle!(LoggingLevel
3             , LoggingLevel.Debug,   "Debug: %1$s",   "[%2$s] Debug: %1$s"
4             , LoggingLevel.Notice,  "Notice: %1$s",  "[%2$s] Notice: %1$s"
5             , LoggingLevel.Warning, "Warning: %1$s", "[%2$s] Warning: %1$s"
6             , LoggingLevel.Fatal,   "Fatal: %1$s",   "[%2$s] Fatal: %1$s"
7             , LoggingLevel.Muted,   "",              ""
8             );

Meta