-
Notifications
You must be signed in to change notification settings - Fork 4.7k
1.1. Thread Safety
Gabi Melman edited this page Jul 15, 2018
·
26 revisions
The functions under spdlog::
are thread safe, except for the following that should not be called if loggers in other threads might execute in same time:
void spdlog::set_error_handler(log_err_handler);
To create thread safe loggers, use the _mt factory functions.
For example:
auto logger = spdlog::basic_logger_mt(...);
To create single threaded loggers, use the _st factory functions.
For example:
auto logger = spdlog::basic_logger_st(...);
The following method should not be called concurrently by different threads on same logger instance:
void spdlog::logger::set_error_handler(log_err_handler);
-
Thread safe sinks: sinks ending with
_mt
(e.gdaily_file_sink_mt
) -
Non thread safe sinks: sinks ending with
_st
(e.gdaily_file_sink_st
)