SPDLOG_LOGGER_CALL_(spdlog::level::critical,__VA_ARGS__) #define LogCriticalIf(b, ...) \ do { \ if ((b)) { \ SPDLOG_LOGGER_CALL_(spdlog::level::critical,__VA_ARGS__); \ } \ } while (0) #ifdef WIN32 #define errcode WSAGetLastError() #endif #endif//_LOG_0B0512CC_B1CC...
SPDLOG_LOGGER_CALL(logger, spdlog::level::debug, __VA_ARGS__) # define SPDLOG_DEBUG(...) SPDLOG_LOGGER_DEBUG(spdlog::default_logger_raw(), __VA_ARGS__) #else # define SPDLOG_LOGGER_DEBUG(logger, ...) (void)0 # define SPDLOG_DEBUG(...) (void)0 #endif #if SPDLOG_ACTIVE_LEVEL...
(std::stringlevel);private:std::shared_ptr<spdlog::logger>mLogger;fs::pathmLogDir=fs::current_path();std::stringmLogNamePrefix="log_";boolmConsole=true;std::stringmLevel="debug";};// 有代码行号// #define LOG_TRACE(...) SPDLOG_LOGGER_CALL(Logger::instance().getLogger().get(), ...
please make sure to call spdlog::drop_all() before main() exit. If some loggers are not in the registry, those should be released manually as well.stackoverflow: std::thread join hangs if called after main exits when using vs2012 rc ...
logger - a new file is created every day on 2:30amauto daily_logger=spd::daily_logger_mt("daily_logger","E:/GitCode/Messy_Test/testdata/daily_log",2,30);// trigger flush if the log severity is error or higherdaily_logger->flush_on(spd::level::err);daily_logger->info(123.44);...
// Just call spdlog::set_async_mode(q_size) and all created loggers from now on will be asynchronous.. // size_t q_size = 1048576; //queue size must be power of 2 spdlog::set_async_mode(q_size); auto async_file = spd::daily_logger_st(“async_file_logger”, “logs/async_log...
auto callback_sink = std::make_shared<spdlog::sinks::callback_sink_mt>([](const spdlog::details::log_msg& msg) { //日志记录器名称 std::string name(msg.logger_name.data(), 0, msg.logger_name.size()); //日志消息 std::string str(msg.payload.data(), 0, msg.payload.size()); ...
The naive implementation of this is to add the level + tracing check inside the CALL macro, while keeping logger::log unchanged (so redundantly checking), but I'm a little worried about the object code and possible performance hit. Yes, that my opinion as well. Need to bench and see. ...
Logger类的构造函数被私有化,防止外部直接创建实例。 提供了getInstance静态成员函数来获取单例实例。 线程安全: 使用std::once_flag和std::call_once确保初始化代码只执行一次,并且是线程安全的。 spdlog封装: 在initSpdlog函数中配置并初始化spdlog。 提供了info、warn、error等日志记录接口,这些接口内部调用spdlog...
// Loggers can store in a ring buffer all messages (including debug/trace) and display later on demand.// When needed, call dump_backtrace() to see them spdlog::enable_backtrace(32); // Store the latest 32 messages in a buffer. Older messages will be dropped.// or my_logger->...