72 constexpr static const uint NumLevels = uint(LogLevel::COUNT);
76 static Logger& get() {
return sDefault; }
78 void Error (
const std::string &s) { emit(LogLevel::ERROR,
" EE ", s); }
79 void Warn (
const std::string &s) { emit(LogLevel::WARNING,
" WW ", s); }
80 void Info (
const std::string &s) { emit(LogLevel::INFO,
" II ", s); }
81 void Notice(
const std::string &s) { emit(LogLevel::NOTICE,
" NN ", s); }
82 void Debug (
const std::string &s) { emit(LogLevel::DEBUG,
" DD ", s); }
83 void Trace (
const std::string &s) { emit(LogLevel::TRACE,
" TT ", s); }
85 bool visible(LogLevel v)
const {
return mLevel >= v; }
87 void setLevel(
const std::string&);
88 void setDefaultLevel(
const std::string&);
89 void setLevel(LogLevel);
90 void setPrefix(
const std::string&);
91 void setTarget(LogLevel,
const std::string &path);
95 static char levelChar(LogLevel);
96 static LogLevel level(
const std::string_view name);
97 static std::string nowString();
98 static std::string formatDurationUS(uint64_t us);
99 static std::string formatMask(uint32_t);
102 static const char sLevelChars[NumLevels];
103 static Logger sDefault;
106 LogLevel mLevel{LogLevel::INFO};
111 void emit(LogLevel,
const char *pfx,
const std::string&);