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).

$(TS) 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.

Members

Functions

formatConsoleOutput
string formatConsoleOutput(string message, Style level)
Undocumented in source. Be warned that the author may not have intended to support it.
formatFileOutput
string formatFileOutput(string message, Style level)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

Example of default style

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

Meta