@gabime gabime released this Aug 5, 2018 · 342 commits to v1.x since this release

Assets 2

Version 1.0.0 is a major release with numerous features and improvements.
It contains some breaking API changes that are not compatible with 0.x versions (see below).


  • Include what you need: Reduce compilation times by including only the minimum required. Users can now to include only the actual sinks/features they need from spdlog/sinks folder.

  • Upgrade to fmt lib version 5.1 - thanks @vitaut for this great lib.

  • Support for custom formatting per sink - each sink can have it's own formatting and level using sink->set_pattern(..) or sink->set_formatter(..).

  • async logging - thread pool - async loggers now share a global thread pool by default.
    Creating and destroying async loggers is cheap now. This is in contrast to previous versions were creating async loggers was expensive, since each logger instance had its own worker thread and queue.
    The global thread pool and can be configured using spdlog::init_thread_pool(queue_size, worker_threads) or created directly using make_shared.

  • periodic flusher: spdlog::flush_every(seconds) to periodically flush all registered loggers.

  • Improved performance - by caching some recently used values in the pattern formatter.

  • Ability to add sinks to a logger after its creation (but it is not thread safe to do so - so use with caution).

Breaking changes

  • Include what you need. For example to use basic_logger add #include "spdlog/sinks/basic_file_sink.h" (see example in readme).

  • To use async loggers - include "spdlog/async.h"

  • Replaced set_async_mode(..) with factory template. For example:

 auto logger= spdlog::rotating_logger_mt<spdlog::async_factory>(...);
  • Removed printf support.

  • Removed warmup/teardown functions from async.

  • Custom sinks inheriting from sinks::base_sink need to format (if needed) the message before sending to their target. For example

void sink_it_(const details::log_msg &msg) override
  fmt::memory_buffer formatted;
  sink::formatter_->format(msg, formatted);
  // sink the formatted
  • Added clone() virtual function to the formatter interface.

  • Removed support for #define SPDLOG_NO_REGISTRY_MUTEX

Change log

See here the complete list of changes.