Skip to content

v2.7.0

Compare
Choose a tag to compare
@odygrd odygrd released this 06 Feb 00:11
· 517 commits to master since this release

Fixes

  • Remove references to build directory path from the compiled library's
    symbols. (#221)
  • Fix when compiled as shared library with hidden visibility. (#222)
  • Fix equal timestamp log messages appearing out of order. (#223)
  • Fix 'rename_file' throwing an exception while being marked
    as noexcept. (#230)
  • Fix crash with std::bad_alloc and compiler warnings in gcc 7.3.1. (#235)
  • Any additional compiler definitions will now be propagated to the parent targets when enabling options in CMake. (#235)

Improvements

  • Improved performance and throughput of the backend logging thread by approximately ~25%

  • Add missing quill::json_file_handler(...) that creates a JsonFileHandler in Quill.h.

  • Simplified and refactored the logic in BoundedQueue.

  • Added the option do_fsync which also calls fsync() during the handler flush to all file handlers.

  • Replace backend_thread_sleep_duration with backend_thread_yield in Config.h

  • Remove trailing spaces in log levels strings. (#237)

  • Reduce padding in some structs.

  • The default log pattern has changed
    to "%(ascii_time) [%(thread)] %(fileline:<28) LOG_%(level_name:<9) %(logger_name:<12) %(message)")

  • Added file event notifiers, to get callbacks from quill before/after log file has been opened or
    closed. (#193)
    This is useful for cleanup procedures or for adding something to the start/end of the log files.
    for example

    int main()
    {
      quill::start();
    
      quill::FileEventNotifier fen;
    
      fen.before_open = [](quill::fs::path const& filename)
      { std::cout << "before opening " << filename << std::endl; };
    
      fen.after_open = [](quill::fs::path const& filename, FILE* f)
      { std::cout << "after opening " << filename << std::endl; };
    
      fen.before_close = [](quill::fs::path const& filename, FILE* f)
      { std::cout << "before closing " << filename << std::endl; };
    
      fen.after_close = [](quill::fs::path const& filename)
      { std::cout << "after closing " << filename << std::endl; };
    
      quill::Handler* file_handler =
        quill::file_handler("myfile.log", "w", quill::FilenameAppend::None, std::move(fen));
    
      quill::Logger* mylogger = quill::create_logger("mylogger", file_handler);
    
      LOG_INFO(mylogger, "Hello world");
    }
  • Added QUILL_X86ARCH in Tweakme.h. When enabled it will attempt to minimize the cache pollution on x86 cpus that
    support the instructions _mm_prefetch , _mm_clflush and _mm_clflushopt.

    To compile when this flag is enabled you should also pass -march to the compiler which is required,
    you can set this to your oldest cpu architecture among your systems.

    To enable this option, DQUILL_X86ARCH must always be defined in quill library and also in your executable,
    for example

    cmake -DCMAKE_CXX_FLAGS:STRING="-DQUILL_X86ARCH -march=native"
  • Added quill:get_root_logger() which gives quick access to the root logger object and can be used directly in the hot
    path.
    This gives applications that only wish to use the root logger the convenience of not having to store and
    pass Logger* objects anymore.
    for example quill existing log macros can be overwritten to not require a Logger* anymore

    #define MY_LOG_INFO(fmt, ...) QUILL_LOG_INFO(quill::get_root_logger(), fmt, ##__VA_ARGS__)
  • Added QUILL_ROOT_LOGGER_ONLY in Tweakme.h. Define ths if you only plan to use the single root logger object,
    When this is defined it will replace the LOG_ macros with the equivalent LOG_ macros but without the need of
    passing Logger* objects anymore.
    for example

    #define QUILL_ROOT_LOGGER_ONLY
    #include "quill/Quill.h"
    
    int main()
    {
      quill::start();
    
      // because we defined QUILL_ROOT_LOGGER_ONLY we do not have to pass a logger* anymore, the root logger is always used
      LOG_INFO("Hello {}", "world");
      LOG_ERROR("This is a log error example {}", 7);
    }