feat(template): adds the {level_short} template tag.
This commit is contained in:
parent
fee6c60176
commit
fbb8318804
2 changed files with 15 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,std::string> _level_word;
|
||||
/** Dictionary of level string to their identifier. */
|
||||
std::map<std::string,level> _word_level;
|
||||
/** dictionary of level identifier to their 4-letters representation. */
|
||||
std::map<level,std::string> _level_short;
|
||||
/** Dictionary of level identifier to their format. */
|
||||
std::map<level,fmt> _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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue