Skip to content
Gabi Melman edited this page Jul 17, 2018 · 26 revisions

Functions under the spdlog:: namespace

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:

spdlog::set_error_handler(log_err_handler); // or logger->set_error_handler(log_err_handler);

Loggers

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(...);

Sinks

  • Thread safe sinks: sinks ending with _mt (e.g daily_file_sink_mt)
  • Non thread safe sinks: sinks ending with _st (e.g daily_file_sink_st)