Skip to content

Releases: odygrd/quill

v6.1.0

09 Aug 19:38
3115567
Compare
Choose a tag to compare
  • Fix various compiler warnings
  • Minor serialisation improvements in Array.h and Chrono.h
  • Introduced Backend::acquire_manual_backend_worker() as an advanced feature, enabling users to manage the backend worker on a custom thread. This feature is intended for advanced use cases where greater control over threading is required. (#519)
  • Add new CsvWriter utility class for asynchronous CSV file writing. For example:
    #include "quill/Backend.h"
    #include "quill/core/FrontendOptions.h"
    #include "quill/CsvWriter.h"
    
    struct OrderCsvSchema
    {
      static constexpr char const* header = "order_id,symbol,quantity,price,side";
      static constexpr char const* format = "{},{},{},{:.2f},{}";
    };
    
    int main()
    {
      quill::BackendOptions backend_options;
      quill::Backend::start(backend_options);
      
      quill::CsvWriter<OrderCsvSchema, quill::FrontendOptions> csv_writer {"orders.csv"};
      csv_writer.append_row(13212123, "AAPL", 100, 210.32321, "BUY");
      csv_writer.append_row(132121123, "META", 300, 478.32321, "SELL");
      csv_writer.append_row(13212123, "AAPL", 120, 210.42321, "BUY");
    }

v6.0.0

27 Jul 12:56
Compare
Choose a tag to compare
  • Added a Cheat Sheet to help users get the most out of the logging library

  • Removed ArgSizeCalculator<>, Encoder<>, and Decoder<> classes. These have been consolidated into a single Codec class. Users who wish to pass user-defined objects should now specialize this single Codec class instead of managing three separate classes. For guidance, please refer to the updated advanced example

  • Added TriviallyCopyableCodec.h to facilitate serialization for trivially copyable user-defined types. For example

      struct TCStruct
      {
        int a;
        double b;
        char c[12];
        
        friend std::ostream& operator<<(std::ostream& os, TCStruct const& arg)
        {
          os << "a: " << arg.a << ", b: " << arg.b << ", c: " << arg.c;
          return os;
        }
      };
      
      template <>
      struct fmtquill::formatter<TCStruct> : fmtquill::ostream_formatter
      {
      };
      
      template <>
      struct quill::Codec<TCStruct> : quill::TriviallyCopyableTypeCodec<TCStruct>
      {
      };
      
      int main()
      {
        // init code ...
        
        TCStruct tc;
        tc.a = 123;
        tc.b = 321;
        tc.c[0] = '\0';
        LOG_INFO(logger, "{}", tc);
      }
  • Added support for passing arithmetic or enum c style arrays when std/Array.h is included. For example

      #include "quill/std/Array.h"
    
      int a[6] = {123, 456};
      LOG_INFO(logger, "a {}", a);
  • Added support for void const* formatting. For example

        int a = 123;
        int* b = &a;
        LOG_INFO(logger, "{}", fmt::ptr(b));
  • Added support for formatting std::chrono::time_point and std::chrono::duration with the inclusion
    of quill/std/Chrono.h

    #include "quill/std/Chrono.h"
    
    std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
    LOG_INFO(logger, "time is {}", now);
  • Removed unused method from ConsoleSink

v5.1.0

21 Jul 11:55
Compare
Choose a tag to compare
  • Fix unit tests on FreeBSD (#496)
  • Resolved unused variable warning on MSVC.
  • Updated CMake to avoid adding -fno-exceptions to the entire target when QUILL_NO_EXCEPTIONS=ON (#499)
  • Fix an issue where timestamps were incorrectly calculated when using quill::Timezone::LocalTime. This bug affected timezones that did not have an exact hour difference from UTC, leading to incorrect timestamp calculations. (#498)
  • The newline character \n is now considered printable by default and will no longer be sanitized. Users can now include new lines in their logs directly. In versions 4.4.1 and earlier, \n was not sanitized, and this behavior is restored in this update, eliminating the need for a custom check_printable_char function in BackendOptions.
  • On Windows, when colors are enabled in ConsoleSink, GetConsoleScreenBufferInfo may fail in the debug console. Previously, this would result in an error being displayed but no logs being written. This issue is now resolved: the error is reported once, and logs will be written to the console without colors.
  • Improved performance of StringFromTime and TimestampFormatter used by the backend worker thread.
  • Replaced std::mutex with a spinlock, resulting in minor performance improvement for backend worker. This change also avoids including <mutex> in the frontend, particularly when following the recommended_usage
    example
  • Update bundled libfmt to 11.0.2

v5.0.0

13 Jul 13:17
Compare
Choose a tag to compare
  • Fix build failure on Windows Arm64 (#485)

  • Previously, wide string support was included in Codec.h. Wide string functionality has now been moved to a separate header file, WideStrings.h. On Windows, logging wide strings now requires the inclusion of quill/std/WideStrings.h.

  • Added QUILL_IMMEDIATE_FLUSH preprocessor variable. This variable can be defined before including LogMacros.h or passed as a compiler flag. When QUILL_IMMEDIATE_FLUSH is defined, the library will flush the log on each log statement. This causes the caller thread to wait for the log to be processed and written to the log file by the backend thread before continuing, significantly impacting performance. This feature is useful for debugging the application when synchronized logs are required. (#488)

  • Introduced log_level_descriptions and log_level_short_codes in BackendOptions to allow customization of LogLevel descriptions and short codes, replacing previously hardcoded values. This enhancement enables users to define their own descriptions and short codes for each log level. For instance, instead of displaying LOG_WARNING, it can now be configured to show LOG_WARN. (#489)

    quill::BackendOptions backend_options;
    backend_options.log_level_descriptions[static_cast<uint32_t>(quill::LogLevel::Warning)] = "WARN";
    quill::Backend::start(backend_options);
  • Introduced LOGV_LEVEL, LOGV_LEVEL_LIMIT, and LOGV_LEVEL_WITH_TAGS macros. These new macros simplify logging by automatically printing variable names and values without explicitly specifying each variable name or using {} placeholders in the format string. Each macro can handle up to 26 arguments. The format string is concatenated at compile time, there is no runtime overhead for using these macros. For example:

      int a = 123;
      double b = 3.17;
      LOGV_INFO(logger, "A message with two variables", a, b)

    outputs A message with two variables [a: 123, b: 3.17]

  • Introduced LOGJ_LEVEL, LOGJ_LEVEL_LIMIT, and LOGJ_LEVEL_WITH_TAGS macros. These new macros simplify JSON logging by automatically embedding the name of each passed variable as a named argument in the format string. Each macro can handle up to 26 arguments. The format string is concatenated at compile time, there is no runtime overhead for using these macros. For example:

      int var_a = 123;
      std::string var_b = "test";
      LOGJ_INFO(logger, "A json message", var_a, var_b);

    outputs {"log_level":"INFO","message":"A json message {var_a}, {var_b}","var_a":"123","var_b":"test"}

  • Enhanced the filter function to also receive the formatted log_message alongside the log_statement, enabling the comparison and filtering of log_message while disregarding elements like timestamps from the full log_statement. (#493)

  • Renamed log_message to log_statement and should_log_message to should_log_statement in Logger

  • Replaced %(log_level_id) with %(log_level_short_code) in the PatternFormatter.

  • Fix a CMakeLists error for old CMake versions prior to 3.19. (#491)

v4.5.0

26 Jun 13:52
Compare
Choose a tag to compare
  • The backend now automatically sanitizes non-printable characters in log messages by converting them to their hexadecimal representation. This feature ensures logs contain only safe, readable characters. You can customize or disable this feature through the BackendOptions by modifying the check_printable_char callback.

    std::function<bool(char c)> check_printable_char = [](char c) { return c >= ' ' && c <= '~'; };
  • Added StringRef, a utility class for passing string arguments by reference without copying. Suitable for string literals or immutable strings with a guaranteed persistent lifetime. For example

    #include "quill/StringRef.h"
    
    static constexpr std::string_view sv {"string_view"};
    LOG_INFO(logger, "{} {}", quill::utility::StringRef{sv}, quill::utility::StringRef{"string_literal"});
  • Renamed write_log_message to write_log in Sink. The formatted log_message and process_id are now also provided. This enhancement supports use cases where the formatted log_statement passed to the Sink can be ignored and overwritten with a custom format, allowing a single Logger to output different formats to various Sinks (#476)

  • Fixed a bug in JSON logging where previously cached named arguments could erroneously append to subsequent log statements. (#482)

v4.4.1

16 Jun 17:31
Compare
Choose a tag to compare
  • Fixed multiple definitions of quill::detail::get_error_message (#469)
  • Fixed an issue causing a SIGABRT when creating directories with a symlink folder path using GCC versions 8 or 9 (#468)
  • Added an assertion to prevent the use of custom FrontendOptions together with default FrontendOptions (#453)

v4.4.0

10 Jun 18:45
Compare
Choose a tag to compare
  • Introduced log_timestamp_ordering_grace_period parameter, replacing enable_strict_log_timestamp_order in
    BackendOptions. Enables strict timestamp ordering with configurable grace period.
  • Fixed an issue where symbols were not properly exported with hidden visibility when compiling as a shared
    library. (#463)
  • Move version info into quill namespace (#465)
  • Upstreamed Meson build integration. See details here
  • Upstreamed Bazel build integration. See details here

v4.3.0

02 Jun 03:23
Compare
Choose a tag to compare
  • Refactored BacktraceStorage to simplify the code.
  • Fixed multiple definitions of on_alarm in SignalHandler.h
  • Fixed a bug in the backend thread where flush() and run_periodic_tasks() were skipped for certain sinks. All sinks
    are now correctly processed.

v4.2.1

01 Jun 10:57
Compare
Choose a tag to compare
  • Added -Wno-gnu-zero-variadic-macro-arguments as an interface compiler flag in CMake. Prior to this version, users had to manually pass this flag to their targets to suppress related warnings.

v4.2.0

30 May 21:54
Compare
Choose a tag to compare
  • Fixed the compile-time exclusion of log levels. Renamed the QUILL_COMPILE_OUT_LOG_LEVEL preprocessor
    flag to QUILL_COMPILE_ACTIVE_LOG_LEVEL.
  • Fixed build error when UnboundedDropping queue is used.
  • Fixed a bug introduced in v4.1.0, which resulted in messages being logged out of order when
    the transit_events_soft_limit was reached. Additionally, this issue affected the behavior of flush_log(),
    prematurely unblocking the thread before all messages were flushed.
  • Fixed -Wno-unused-parameter and -Wdocumentation warnings.
  • Improved backend worker _exit() functionality and reduced code duplication in other areas of the backend worker code.
  • Added signal_handler_timeout_seconds parameter, which controls the timeout duration for the signal handler. Only
    available on Linux platforms.
  • Added sleep_duration_ns parameter to the flush_log(...) function. This parameter specifies the duration in
    nanoseconds to sleep between retries between checks for the flush completion and when a blocking queue is used,
    and it is full. The default sleep duration is 100 nanoseconds, but users can now customize this duration according to
    their needs. If a zero sleep duration is passed, the thread might yield instead.
  • Removed uses of std::this_thread::sleep_for(...), std::string, std::vector in the signal handler when waiting for the log to be flushed.