Description
XTR is a C++ logging library aimed at applications with low-latency or real-time requirements. The cost of log statements is minimised by delegating as much work as possible to a background thread. Work done at the log statement call-site is minimized---for example a no argument log statement only involves writing a single pointer to a ring buffer.
It is designed so that the cost of a log statement is consistently fast---i.e. every call is fast, not just the average case. No allocations or system calls are made when a log statement is made.
xtr alternatives and similar libraries
Based on the "Logging" category.
Alternatively, view xtr alternatives based on common mentions on social networks and blogs.
-
easyloggingpp
Single header C++ logging library. It is extremely powerful, extendable, light-weight, fast performing, thread and type safe and consists of many built-in features. It provides ability to write logs in your own customized format. It also provide support for logging your classes, third-party libraries, STL and third-party containers etc. -
Easylogging++
Single header C++ logging library. It is extremely powerful, extendable, light-weight, fast performing, thread and type safe and consists of many built-in features. It provides ability to write logs in your own customized format. It also provide support for logging your classes, third-party libraries, STL and third-party containers etc. -
log4cplus
log4cplus is a simple to use C++ logging API providing thread-safe, flexible, and arbitrarily granular control over log management and configuration. It is modelled after the Java log4j API. -
G3log
G3log is an asynchronous, "crash safe", logger that is easy to use with default logging sinks or you can add your own. G3log is made with plain C++14 (C++11 support up to release 1.3.2) with no external libraries (except gtest used for unit tests). G3log is made to be cross-platform, currently running on OSX, Windows and several Linux distros. See Readme below for details of usage. -
reckless
Reckless logging. Low-latency, high-throughput, asynchronous logging library for C++. -
logog
logog is a portable C++ library to facilitate logging of real-time events in performance-oriented applications, such as games. It is especially appropriate for projects that have constrained memory and constrained CPU requirements. -
Serenity Logger
Yet another Fast and Efficient logging framework. The goal is to be nanosecond level fast with extensibility (inspired by loggers such as spdlog, nanolog, and fmtlog and heavily influenced by the formatting used in fmtlib and <format>). This uses a built-in formatter that can be swapped out for <format> or fmtlib if desired. -
templog
A very small and lightweight C++ library which you can use to add logging to your C++ applications. [Boost] -
Log4cpp
A library of C++ classes for flexible logging to files, syslog, IDSA and other destinations. [LGPL]
Access the most powerful time series database as a service
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of xtr or a related project?
Popular Comparisons
README
xtr
What is it?
XTR is a C++ logging library aimed at applications with low-latency or real-time requirements. The cost of log statements is minimised by delegating as much work as possible to a background thread.
It is designed so that the cost of a log statement is consistently fast---i.e. every call is fast, not just the average case. No allocations or system calls are made when a log statement is made.
Features
- Fast (please see benchmark results).
- No allocations when logging, even when logging strings.
- Formatting, I/O etc are all delegated to a background thread. Work done at the log statement call-site is minimized---for example a no argument log statement only involves writing a single pointer to a ring buffer.
- Safe: No references taken to arguments unless explicitly requested.
- Comprehensive suite of unit tests which run cleanly under AddressSanitizer, UndefinedBehaviourSanitizer, ThreadSanitizer and LeakSanitizer.
- Log sinks with independent log levels (so that levels for different subsystems may be modified independently).
- Ability to modify log levels via an external command.
- Non-printable characters are sanitized for safety (to prevent terminal escape sequence injection attacks).
- Formatting done via fmtlib.
- Support for custom I/O back-ends (e.g. to log to the network or syslogd).
- Support for logrotate integration.
- Support for systemd journal integration.
Supported platforms
- Linux (x86-64)
- FreeBSD (x86-64)
Documentation
Benchmarks
Below is the output of make benchmark
on a stock Ryzen 5950X, with g++ version 10.2.1. No cores are isolated. Benchmarks with isolation, and on other CPUs will be completed soon.
2021-07-31 22:30:11
Running build/g++-release/benchmark/benchmark
Run on (32 X 6614.06 MHz CPU s)
CPU Caches:
L1 Data 32K (x16)
L1 Instruction 32K (x16)
L2 Unified 512K (x16)
L3 Unified 32768K (x2)
Load Average: 1.26, 1.53, 1.42
***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.
-----------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------------------------------------------
logger_benchmark_discard 3.12 ns 3.11 ns 220642542
logger_benchmark_devnull 3.17 ns 3.16 ns 213233572
logger_benchmark_tsc_discard 9.97 ns 9.95 ns 71544694
logger_benchmark_tsc_devnull 9.81 ns 9.79 ns 72024706
logger_benchmark_clock_realtime_coarse_discard 9.50 ns 9.48 ns 75301078
logger_benchmark_clock_realtime_coarse_devnull 9.02 ns 8.99 ns 77431937
logger_benchmark_int_discard 4.64 ns 4.63 ns 151861070
logger_benchmark_int_devnull 4.62 ns 4.61 ns 151949835
logger_benchmark_long_discard 4.61 ns 4.60 ns 151969132
logger_benchmark_long_devnull 4.61 ns 4.60 ns 152198709
logger_benchmark_double_discard 4.84 ns 4.82 ns 145809754
logger_benchmark_double_devnull 4.81 ns 4.80 ns 145367066
logger_benchmark_c_str_discard 7.63 ns 7.60 ns 93103583
logger_benchmark_c_str_devnull 7.33 ns 7.30 ns 95755773
logger_benchmark_str_view_discard 5.69 ns 5.66 ns 122769764
logger_benchmark_str_view_devnull 5.67 ns 5.64 ns 124657115
logger_benchmark_str_discard 7.36 ns 7.33 ns 96002018
logger_benchmark_str_devnull 7.32 ns 7.29 ns 96072575
logger_benchmark_non_blocking_discard 3.13 ns 3.12 ns 224529741
logger_benchmark_non_blocking_devnull 3.09 ns 3.08 ns 228207878
Installation notes
See [INSTALL.md](INSTALL.md)