|
|
@ -109,7 +109,8 @@ public:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef SPDLOG_SOURCE_LOCATION
|
|
|
|
#ifdef SPDLOG_SOURCE_LOCATION // off by default. define SPDLOG_SOURCE_LOCATION before including
|
|
|
|
|
|
|
|
// spdlog to enable.
|
|
|
|
template <typename... Args>
|
|
|
|
template <typename... Args>
|
|
|
|
void trace(loc_with_fmt fmt, Args &&...args) {
|
|
|
|
void trace(loc_with_fmt fmt, Args &&...args) {
|
|
|
|
log(fmt.loc, level::trace, fmt.fmt_string, std::forward<Args>(args)...);
|
|
|
|
log(fmt.loc, level::trace, fmt.fmt_string, std::forward<Args>(args)...);
|
|
|
@ -165,7 +166,7 @@ public:
|
|
|
|
void critical(string_view_t msg, source_loc loc = source_loc::current()) {
|
|
|
|
void critical(string_view_t msg, source_loc loc = source_loc::current()) {
|
|
|
|
log(loc, level::critical, msg);
|
|
|
|
log(loc, level::critical, msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#else // without source location
|
|
|
|
template <typename... Args>
|
|
|
|
template <typename... Args>
|
|
|
|
void trace(format_string_t<Args...> fmt, Args &&...args) {
|
|
|
|
void trace(format_string_t<Args...> fmt, Args &&...args) {
|
|
|
|
log(level::trace, fmt, std::forward<Args>(args)...);
|
|
|
|
log(level::trace, fmt, std::forward<Args>(args)...);
|
|
|
@ -198,17 +199,12 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
// log functions with no format string, just string
|
|
|
|
// log functions with no format string, just string
|
|
|
|
void trace(string_view_t msg) { log(level::trace, msg); }
|
|
|
|
void trace(string_view_t msg) { log(level::trace, msg); }
|
|
|
|
|
|
|
|
|
|
|
|
void debug(string_view_t msg) { log(level::debug, msg); }
|
|
|
|
void debug(string_view_t msg) { log(level::debug, msg); }
|
|
|
|
|
|
|
|
|
|
|
|
void info(string_view_t msg) { log(level::info, msg); }
|
|
|
|
void info(string_view_t msg) { log(level::info, msg); }
|
|
|
|
|
|
|
|
void warn(string_view_t msg) { log(level::warn, msg); }
|
|
|
|
inline void warn(string_view_t msg) { log(level::warn, msg); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void error(string_view_t msg) { log(level::err, msg); }
|
|
|
|
void error(string_view_t msg) { log(level::err, msg); }
|
|
|
|
|
|
|
|
|
|
|
|
void critical(string_view_t msg) { log(level::critical, msg); }
|
|
|
|
void critical(string_view_t msg) { log(level::critical, msg); }
|
|
|
|
#endif
|
|
|
|
#endif // SPDLOG_SOURCE_LOCATION
|
|
|
|
|
|
|
|
|
|
|
|
// return true if logging is enabled for the given level.
|
|
|
|
// return true if logging is enabled for the given level.
|
|
|
|
[[nodiscard]] bool should_log(level msg_level) const {
|
|
|
|
[[nodiscard]] bool should_log(level msg_level) const {
|
|
|
@ -241,7 +237,6 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
// sinks
|
|
|
|
// sinks
|
|
|
|
[[nodiscard]] const std::vector<sink_ptr> &sinks() const;
|
|
|
|
[[nodiscard]] const std::vector<sink_ptr> &sinks() const;
|
|
|
|
|
|
|
|
|
|
|
|
[[nodiscard]] std::vector<sink_ptr> &sinks();
|
|
|
|
[[nodiscard]] std::vector<sink_ptr> &sinks();
|
|
|
|
|
|
|
|
|
|
|
|
// error handler
|
|
|
|
// error handler
|
|
|
|