13 #define SPDLOG_CATCH_AND_HANDLE \ 14 catch (const std::exception &ex) \ 16 err_handler_(ex.what()); \ 20 err_handler_("Unknown exception in logger"); \ 50 sink->set_formatter(f->
clone());
56 auto new_formatter = details::make_unique<spdlog::pattern_formatter>(
std::move(pattern), time_type);
60 template<
typename... Args>
79 template<
typename... Args>
150 template<
typename... Args>
156 template<
typename... Args>
162 template<
typename... Args>
168 template<
typename... Args>
174 template<
typename... Args>
180 template<
typename... Args>
222 #ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT 226 int wbuf_size =
static_cast<int>(wbuf.size());
232 auto result_size = ::WideCharToMultiByte(CP_UTF8, 0, wbuf.data(), wbuf_size, NULL, 0, NULL, NULL);
236 target.resize(result_size);
237 ::WideCharToMultiByte(CP_UTF8, 0, wbuf.data(), wbuf_size, &target.data()[0], result_size, NULL, NULL);
245 template<
typename... Args>
260 wbuf_to_utf8buf(wbuf, buf);
267 template<
typename... Args>
273 template<
typename... Args>
279 template<
typename... Args>
285 template<
typename... Args>
291 template<
typename... Args>
297 template<
typename... Args>
303 template<
typename... Args>
309 #endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT 371 return msg_level >=
level_.load(std::memory_order_relaxed);
380 #if defined(SPDLOG_ENABLE_MESSAGE_COUNTER) 385 if (sink->should_log(msg.
level))
415 std::strftime(date_buf,
sizeof(date_buf),
"%Y-%m-%d %H:%M:%S", &tm_time);
436 auto cloned = std::make_shared<spdlog::logger>(
std::move(logger_name),
sinks_.begin(),
sinks_.end());
437 cloned->set_level(this->
level());
const CharType(& source)[N]
level::level_enum flush_level() const
std::atomic< time_t > last_err_time_
void incr_msg_counter_(details::log_msg &msg)
void error(const char *fmt, const Args &...args)
log_err_handler error_handler() const
std::initializer_list< sink_ptr > sinks_init_list
void warn(const char *fmt, const Args &...args)
log_err_handler err_handler_
void msg(const char *fmt,...)
std::atomic< size_t > msg_counter_
void log(level::level_enum lvl, const char *fmt, const Args &...args)
void info(const char *fmt, const Args &...args)
#define SPDLOG_CATCH_AND_HANDLE
const std::vector< sink_ptr > & sinks() const
std::shared_ptr< sinks::sink > sink_ptr
void set_pattern(std::string pattern, pattern_time_type time_type=pattern_time_type::local)
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
std::enable_if< is_contiguous< Container >::value &&internal::is_string< S >::value, std::back_insert_iterator< Container > >::type format_to(std::back_insert_iterator< Container > out, const S &format_str, const Args &...args)
static level::level_enum default_level()
std::vector< sink_ptr > sinks_
bool should_flush_(const details::log_msg &msg)
std::enable_if< internal::is_string< String >::value >::type print(std::FILE *f, const text_style &ts, const String &format_str, const Args &...args)
void default_err_handler_(const std::string &msg)
std::size_t strftime(char *str, std::size_t count, const char *format, const std::tm *time)
void critical(const char *fmt, const Args &...args)
virtual std::shared_ptr< logger > clone(std::string logger_name)
string_view_t & to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
void debug(const char *fmt, const Args &...args)
bool should_log(level::level_enum msg_level) const
spdlog::level_t flush_level_
fmt::string_view string_view_t
level::level_enum level() const
void set_formatter(std::unique_ptr< formatter > formatter)
const GenericPointer< typename T::ValueType > T2 value
void trace(const char *fmt, const Args &...args)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
std::tm localtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT
void set_error_handler(log_err_handler err_handler)
const std::string & name() const
spdlog::string_view_t to_string_view(const fmt::basic_memory_buffer< char, Buffer_Size > &buf) SPDLOG_NOEXCEPT
std::function< void(const std::string &err_msg)> log_err_handler
logger(std::string name, sink_ptr single_sink)
#define SPDLOG_ACTIVE_LEVEL
void set_level(level::level_enum log_level)
void flush_on(level::level_enum log_level)
virtual void sink_it_(details::log_msg &msg)