Skip to content

v8.0.0

Latest
Compare
Choose a tag to compare
@odygrd odygrd released this 16 Jan 15:49
· 1 commit to master since this release
3df568b
  • Updated bundled libfmt to 11.1.2
  • Suppress -Wredundant-decls warning in GCC builds.
  • Remove -Wno-gnu-zero-variadic-macro-arguments for GCC in CMake.
  • Unified JsonFileSink.h and JsonConsoleSink.h into a single header, JsonSink.h, with both classes now sharing a common implementation
  • Users can now inherit from JsonFileSink or JsonConsoleSink and override the generate_json_message(...) function to implement their own custom JSON log formats
  • Removed JsonFileSinkConfig. Please rename it to FileSinkConfig, which retains the same API and is fully compatible.
  • Added RotatingJsonFileSink. Functions like RotatingFileSink, but specifically designed for rotating JSON log files. (#637)
  • Simplified ConsoleSink by applying ANSI colour codes universally across all platforms, including Windows. The previous Windows-specific implementation has been removed. Note that quill::ConsoleColours has been replaced with quill::ConsoleSink::Colours, and quill::ConsoleColours::ColourMode has been renamed to quill::ConsoleSink::ColourMode.
  • Changed class member visibility in FileSink, JsonSink, and RotatingSink from private to protected, enabling easier customization through inheritance for user-defined implementations.
  • Added a new sink_min_flush_interval option in BackendOptions, which specifies the minimum time interval (in milliseconds) before the backend thread flushes the output buffers calling flush_sink() for all sinks, with a default value of 200ms; The backend thread ensures sinks aren't flushed more frequently than this interval, while explicit calls to logger->flush_log() trigger an immediate flush, and flushing may occur less frequently if the backend thread is busy, with this setting applying globally to all sinks. Setting this value to 0 disables the feature. (#641)
  • Added a StopWatch utility for easy logging of elapsed time. It can log the time elapsed since construction in various formats. You can use either quill::StopWatchTsc for high-resolution TSC-based timing or quill::StopWatchChrono for standard std::chrono-based timing. (#640)

For example:

  #include "quill/StopWatch.h"

  quill::StopWatchTsc swt;
  std::this_thread::sleep_for(std::chrono::seconds(1));
  LOG_INFO(logger, "After 1s, elapsed: {:.6}s", swt); // => After 1s, elapsed: 1.00849s
  std::this_thread::sleep_for(std::chrono::milliseconds(500));
  LOG_INFO(logger, "After 500ms, elapsed: {}s", swt); // => After 500ms, elapsed: 1.521880274s
  LOG_INFO(logger, "elapsed: {}", swt.elapsed_as<std::chrono::nanoseconds>()); // => elapsed: 1521807324ns