tools/opening-book/book_maker.cpp
/**
 * initializes the logger
 * @param logfile_path path to the logfile
 * @return             whether the function successfully setup the logger
 */
initializes the logger
@param logfile_path path to the logfile
@return             whether the function successfully setup the logger
initializes the logger @param logfile_path path to the logfile @return whether the function successfully setup the logger
bool init_logger(const std::string& logfile_path) noexcept {
    try {
        auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
        console_sink->set_level(spdlog::level::warn);
        console_sink->set_pattern("[%D %H:%M:%S] [%^%l%$] [Thread %t] [File:Line %@] [Function: %!] %v");
        console_sink->set_color_mode(spdlog::color_mode::always);
        auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(logfile_path, true);
        file_sink->set_level(spdlog::level::trace);
        spdlog::logger logger(logger_name, {console_sink, file_sink});
        logger.set_level(spdlog::level::debug);
        spdlog::set_default_logger(std::make_shared<spdlog::logger>(logger_name, spdlog::sinks_init_list({console_sink, file_sink})));
    } catch (const spdlog::spdlog_ex& ex) {
        std::cout << "Logger initialization failed: " << ex.what() << std::endl;
        return false; 
    }
    return true;
}
bool init_logger ( const std :: string & logfile_path ) noexcept { try { auto console_sink = std :: make_shared < spdlog :: sinks :: stdout_color_sink_mt > ( ) ; console_sink -> set_level ( spdlog :: level :: warn ) ; console_sink -> set_pattern ( " " ) ; console_sink -> set_color_mode ( spdlog :: color_mode :: always ) ; auto file_sink = std :: make_shared < spdlog :: sinks :: basic_file_sink_mt > ( logfile_path , true ) ; file_sink -> set_level ( spdlog :: level :: trace ) ; spdlog :: logger logger ( logger_name , { console_sink , file_sink } ) ; logger . set_level ( spdlog :: level :: debug ) ; spdlog :: set_default_logger ( std :: make_shared < spdlog :: logger > ( logger_name , spdlog :: sinks_init_list ( { console_sink , file_sink } ) ) ) ; } catch ( const spdlog :: spdlog_ex & ex ) { std :: cout << " " << ex . what ( ) << std :: endl ; return false ; } return true ; }
initializes the logger
 @param logfile_path path to the logfile
 @return             whether the function successfully setup the logger
initializes the logger @param logfile_path path to the logfile @return whether the function successfully setup the logger
/// Setup the console sink /// setup the file sink /// setup the logger using both sinks // if we fail to initialize the logger, return false