Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions library/logger/logger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ namespace scarab
spd_initializer( a_pattern ),
f_sink()
{
spdlog::init_thread_pool(8192, 1);
// We check before creating the new thread pool because we've had problems in some situations (e.g. when started from Python)
// with a new thread pool being created and the old one being killed, resulting in strange errors during execution
if( ! spdlog::thread_pool() )
{
spdlog::init_thread_pool(8192, 1);
}
f_sink = std::make_shared< spdlog::sinks::stdout_color_sink_mt >();
f_sink->set_pattern( f_pattern );
auto at_exit_fcn = [](){ logger::stop_using_spd_async(); };
Expand Down Expand Up @@ -201,7 +206,7 @@ namespace scarab
void logger::reset_using_spd_async()
{
#ifdef SCARAB_LOGGER_DEBUG
std::cerr << "Resetting use of spd async" << std::endl;
std::cerr << "[logger::reset_using_spd_async()] Resetting use of spd async" << std::endl;
#endif
logger::using_spd_async().store(true);
std::set< logger* >& t_all_loggers = logger::all_loggers();
Expand Down
2 changes: 1 addition & 1 deletion library/logger/logger.hh
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ namespace scarab
f_initializer_ptr( nullptr )
{
#ifdef SCARAB_LOGGER_DEBUG
std::cout << "Logger <" << a_name << "> was initialized from <" << a_file << ":" << a_line << ">; type: " << ::scarab::type( *this ) << std::endl;
std::cerr << "[logger_type constructor] Logger <" << a_name << "> was initialized from <" << a_file << ":" << a_line << ">; type: " << ::scarab::type( *this ) << std::endl;
#endif
// Start the backend, but only once
static initializer_x s_init;
Expand Down