24 auto now = std::chrono::system_clock::now();
25 auto t = std::chrono::system_clock::to_time_t(now);
26 auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()) % 1000;
32 std::snprintf(buf,
sizeof(buf),
"%02d:%02d:%02d.%03d", tm.tm_hour, tm.tm_min, tm.tm_sec,
33 static_cast<int>(ms.count()));
46 std::string(component) +
"] " + std::string(msg);
47 _sink->write(level, line);
static const char * _levelName(LogLevel level)
static std::string _timestamp()
void info(std::string_view component, std::string_view msg)
void debug(std::string_view component, std::string_view msg)
void error(std::string_view component, std::string_view msg)
void setSink(std::unique_ptr< ILogSink > sink)
Logger(LogLevel threshold=LogLevel::Debug)
void _log(LogLevel level, std::string_view component, std::string_view msg)
std::unique_ptr< ILogSink > _sink
void warn(std::string_view component, std::string_view msg)