StrictLogger

Standard implementation of IStyledLogger interface.

  1. alias StrictLogger = StyledStrictLogger!(LoggingLevel, LoggingLevel.Debug, "Debug:".color(fg.light_magenta) ~ " %1$s", "[%2$s]: Debug: %1$s", LoggingLevel.Notice, "Notice:".color(fg.light_green) ~ " %1$s", "[%2$s]: Notice: %1$s", LoggingLevel.Warning, "Warning:".color(fg.light_yellow) ~ " %1$s", "[%2$s]: Warning: %1$s", LoggingLevel.Fatal, "Fatal:".color(fg.light_red) ~ " %1$s", "[%2$s]: Fatal: %1$s", LoggingLevel.Muted, "", "")
  2. alias StrictLogger = StyledStrictLogger!(LoggingLevel, LoggingLevel.Debug, "Debug:".color(fg.magenta) ~ " %1$s", "[%2$s]: Debug: %1$s", LoggingLevel.Notice, "Notice:".color(fg.green) ~ " %1$s", "[%2$s]: Notice: %1$s", LoggingLevel.Warning, "Warning:".color(fg.light_yellow) ~ " %1$s", "[%2$s]: Warning: %1$s", LoggingLevel.Fatal, "Fatal:".color(fg.light_red) ~ " %1$s", "[%2$s]: Fatal: %1$s", LoggingLevel.Muted, "", "")
    version(ColoredOutput && !Windows)
    alias StrictLogger = StyledStrictLogger!(LoggingLevel, LoggingLevel.Debug, "Debug:".color(fg.magenta) ~ " %1$s", "[%2$s]: Debug: %1$s", LoggingLevel.Notice, "Notice:".color(fg.green) ~ " %1$s", "[%2$s]: Notice: %1$s", LoggingLevel.Warning, "Warning:".color(fg.light_yellow) ~ " %1$s", "[%2$s]: Warning: %1$s", LoggingLevel.Fatal, "Fatal:".color(fg.light_red) ~ " %1$s", "[%2$s]: Fatal: %1$s", LoggingLevel.Muted, "", "")
  3. alias StrictLogger = StyledStrictLogger!(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, "", "")

Examples

shared ILogger logger = new StrictLogger("my_awesome_log.log");
logger.minOutputLevel = LoggingLevel.Warning; // info msgs won't be printed in console 
logger.logInfo("Info message!");
logger.logError("Error message!");
logger.logDebug("Debug message!");

// received USR1 signal from logrotate
logger.reload;

Meta