diff --git a/README.md b/README.md index e18f246..92ac092 100644 --- a/README.md +++ b/README.md @@ -188,6 +188,7 @@ Available tags are: - `{msg}`: the logged message, - `{level}`: the current log level (i.e. `Critical`, `Error`, `Warning`, `Progress`, `Note`, `Info`, `Debug` or `XDebug`), - `{level_letter}`: the first letter of the current log level, +- `{level_short}`: the current log level, printed in only four letters, - `{file}`: the current file (absolute path), - `{func}`: the current function, - `{line}`: the current line number, diff --git a/clutchlog/clutchlog.h b/clutchlog/clutchlog.h index e06c075..cf98ad0 100644 --- a/clutchlog/clutchlog.h +++ b/clutchlog/clutchlog.h @@ -835,6 +835,16 @@ class clutchlog {level::debug ,"Debug"}, {level::xdebug ,"XDebug"} }), + _level_short({ + {level::critical, "Crit"}, + {level::error , "Erro"}, + {level::warning , "Warn"}, + {level::progress, "Prog"}, + {level::note , "Note"}, + {level::info , "Info"}, + {level::debug , "Dbug"}, + {level::xdebug , "XDbg"} + }), _level_fmt({ {level::critical,fmt(fmt::fg::red, fmt::typo::underline)}, {level::error ,fmt(fmt::fg::red, fmt::typo::bold)}, @@ -881,6 +891,8 @@ class clutchlog const std::map _level_word; /** Dictionary of level string to their identifier. */ std::map _word_level; + /** dictionary of level identifier to their 4-letters representation. */ + std::map _level_short; /** Dictionary of level identifier to their format. */ std::map _level_fmt; /** Current format of the standard output. */ @@ -1223,6 +1235,8 @@ class clutchlog std::string letter(1, _level_word.at(stage).at(0)); // char -> string row = replace(row, "\\{level_letter\\}", letter); + row = replace(row, "\\{level_short\\}", _level_short.at(stage)); + #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1 row = replace(row, "\\{name\\}", name); row = replace(row, "\\{depth\\}", depth - _strip_calls);