Skip to content

v9.0.0

Choose a tag to compare

@odygrd odygrd released this 01 Apr 23:16
· 577 commits to master since this release

API Changes

  • Replaced the bool huge_pages_enabled flag in FrontendOptions with quill::HugePagesPolicy huge_pages_policy enum, allowing huge page allocation to be attempted with a fallback to normal pages if unavailable. If you are using a custom FrontendOptions type, you will need to update it to use the new flag. (#707)
  • Previously, QueueType::UnboundedDropping and QueueType::UnboundedBlocking could grow up to 2 GB in size. This limit is now configurable via FrontendOptions::unbounded_queue_max_capacity, which defaults to 2 GB.
  • QueueType::UnboundedUnlimited has been removed, as the same behavior can now be achieved by setting FrontendOptions::unbounded_queue_max_capacity to the maximum value.
  • The ConsoleSink constructor now optionally accepts a ConsoleSinkConfig, similar to other sinks. If no ConsoleSinkConfig is provided, a default one is used, logging to stdout with ColourMode::Automatic. For example:
    Frontend::create_or_get_sink<ConsoleSink>("console_sink",
                                              []()
                                              {
                                                ConsoleSinkConfig config;
                                                config.set_colour_mode(ConsoleSinkConfig::ColourMode::Never);
                                                config.set_stream("stderr");
                                                return config;
                                              }());

New Features

  • The default log level for each Logger can now be configured using the environment variable QUILL_LOG_LEVEL. Supported values: "tracel3", "tracel2", "tracel1", "debug", "info", "notice", "warning", "error", "critical", "none". When set, the logger is initialized with the corresponding log level. If logger->set_log_level(level) is explicitly called in code, it will override the log level set via the environment variable.

  • Added the LOG_RUNTIME_METADATA(logger, log_level, file, line_number, function, fmt, ...) macro. This enables passing runtime metadata (such as file, line number, and function) along with a log message, providing greater flexibility when forwarding logs from other logging libraries. (#696)

    LOG_RUNTIME_METADATA(logger, quill::LogLevel::Info, "main.cpp", 20, "foo()", "Hello number {}", 8);
  • Added a runtime check to detect duplicate backend worker threads caused by inconsistent linkage (e.g., mixing static and shared libraries). If needed, this check can be disabled using the check_backend_singleton_instance flag in BackendOptions. (#687)

  • Added the QUILL_DISABLE_FUNCTION_NAME preprocessor flag and CMake option. This allows disabling __FUNCTION__ in LOG_* macros when %(caller_function) is not used in PatternFormatter, eliminating Clang-Tidy warnings when logging inside lambdas.

  • It is now possible to override a logger's PatternFormatter on a per-sink basis. This allows the same logger to output different formats for different sinks. Previously, achieving this required creating a custom sink type, but this functionality is now built-in. See the example: sink_formatter_override.

  • Added Frontend::remove_logger_blocking(...), which blocks the caller thread until the specified logger is fully removed.

  • Added Frontend::shrink_thread_local_queue(capacity) and Frontend::get_thread_local_queue_capacity(). These functions allow dynamic management of thread-local SPSC queues when using an unbounded queue configuration. They enable on-demand shrinking of a queue that has grown due to bursty logging, helping to reduce memory usage, although in typical scenarios they won't be required.

  • Added the SyslogSink, which logs messages to the system's syslog.

    auto sink = quill::Frontend::create_or_get_sink<quill::SyslogSink>(
      "app", []()
      {
        quill::SyslogSinkConfig config;
        config.set_identifier("app");
        return config;
      }());
  • Added the SystemdSink, which logs messages to systemd.

    auto sink = quill::Frontend::create_or_get_sink<quill::SystemdSink>(
      "app", []()
      {
        quill::SystemdSinkConfig config;
        config.set_identifier("app");
        return config;
      }());
  • Added the AndroidSink, which integrates with Android's logging system.

    auto sink = quill::Frontend::create_or_get_sink<quill::AndroidSink>(
      "s1", []()
      {
        quill::AndroidSinkConfig config;
        config.set_tag("app");
        config.set_format_message(true);
        return config;
      }());

Improvements

  • Updated bundled libfmt to 11.1.4.

  • When add_metadata_to_multi_line_logs in the PatternFormatter was set to false, fixed a bug where the last character of the log message was dropped and added protection for empty messages.

  • Updated LOG_EVERY_N macros to log on the first occurrence (0th call) instead of waiting until the Nth call.

  • Added a nullptr check for char* and const char* during encoding, ensuring the library handles nullptr values gracefully (#735)

  • The CsvWriter could previously be used with RotatingFileSink via the constructor that accepted std::shared_ptr<Sink>, but rotated files did not include the CSV header. This has now been improved—when using the new constructor that accepts quill::RotatingFileSinkConfig, the CSV header is written at the start of each new rotated file. (#700)

    quill::RotatingFileSinkConfig sink_config;
    sink_config.set_open_mode('w');
    sink_config.set_filename_append_option(FilenameAppendOption::None);
    sink_config.set_rotation_max_file_size(512);
    sink_config.set_rotation_naming_scheme(RotatingFileSinkConfig::RotationNamingScheme::Index);
    
    quill::CsvWriter<OrderCsvSchema, quill::FrontendOptions> csv_writer{"orders.csv", sink_config};
    for (size_t i = 0; i < 40; ++i)
    {
      csv_writer.append_row(132121122 + i, "AAPL", i, 100.1, "BUY");
    }
  • When using CsvWriter with open_mode == 'a', the header will no longer be rewritten if the file already exists.

  • On Linux, setting a long backend thread name now truncates it instead of failing. (#691)

  • Fixed BSD builds. (#688)

  • Added adaptive termination for stable measurements in rdtsc calibration during init

  • Fixed QUILL_ATTRIBUTE_HOT and QUILL_ATTRIBUTE_COLD clang detection

  • CMake improvements: switched to range syntax for minimum required version and bumped minimum required CMake version to 3.12. (#686)

  • Correct the installation location of pkg-config files. They are now properly placed in /usr/local/lib. (#715)

  • Removed deprecated TriviallyCopyableTypeCodec