Skip to content

Commit

Permalink
fix queue tests and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
odygrd committed May 15, 2022
1 parent 24f654f commit 6b0941b
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 597 deletions.
26 changes: 24 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- [v2.0.0](#v2.0.0)
- [v1.7.3](#v1.7.3)
- [v1.7.2](#v1.7.2)
- [v1.7.1](#v1.7.1)
Expand All @@ -22,12 +23,33 @@
- [v1.1.0](#v1.1.0)
- [v1.0.0](#v1.0.0)

## v1.7.3 (to be released)
## v2.0.0

From version `v2.0` and onwards only C++17 is supported.

This version is a major refactor.

**Improvements**

- Reduced and simplified codebase.
- Improved backend worker thread performance.
- `QUILL_DUAL_QUEUE_MODE` has been removed. A single queue now handles every case.
- `QUILL_STRING` has been removed. That macro is no longer required when passing a format string to the
PatternFormatter.

**Differences**

- `v1.7x` compiles with C++14, `v2.x` only compiles for C++17.
- `v1.7x` supports wide character logging on Windows, `v2.x` does not. This includes the filename strings that are
passed to the handlers.

## v1.7.3

**Improvements/Fixes**

- Fix crash on windows when a long wstring (>500 chars) is logged ([#173](https://github.com/odygrd/quill/issues/173))
- Fix compiler error when trying to compile with -DQUILL_DISABLE_NON_PREFIXED_MACROS ([#174](https://github.com/odygrd/quill/issues/174))
- Fix compiler error when trying to compile with
-DQUILL_DISABLE_NON_PREFIXED_MACROS ([#174](https://github.com/odygrd/quill/issues/174))
- Fix a compile warning in clang ([#175](https://github.com/odygrd/quill/issues/175))

## v1.7.2
Expand Down
144 changes: 81 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,44 @@
- [Supported Platforms And Compilers](#supported-platforms-and-compilers)
- [Basic Usage](#basic-usage)
- [CMake Integration](#cmake-integration)
- [Documentation](#documentation)
- [License](#license)

- [Documentation](#documentation)
- [License](#license)

| homebrew | vcpkg | conan |
|:---------------------:|:----------------------:|:-----------------:|
| `brew install quill` | `vcpkg install quill` | `quill/[>=1.2.3]` |

| `brew install quill` | `vcpkg install quill` | `quill/[>=1.2.3]` |

## Introduction
Quill is a cross-platform low latency logging library based on C++14.

Quill is a cross-platform low latency logging library based on C++14/C++17.

There are two versions on the library:

`v2.x.x` : C++17 support. **No** support for wide characters logging.

`v1.7.x` : C++14 support.

Going forward any new features will only be added to the C++17 version of the library.
The old library (v1.7.x) still remains there and there will be releases only for bug fixes.

The main goals of the library are:

- **Simplicity** A small example code snippet should be enough to get started and use most of features.
- **Performance** Ultra low latency. No formatting on the hot-path, asynchronous only mode. No hot-path allocations for fundamental types, enums and strings (including `std::string` and `std::string_view`). Any other custom or user defined type gets copy constructed with the formatting done on a backend worker thread.
- **Convenience** Ease application monitoring/debugging. Latency is equal to latencies of binary loggers, but the produced log is in human readable form.
- **Simplicity** A small example code snippet should be enough to get started and use most of features.
- **Performance** Ultra low latency. No formatting on the hot-path, asynchronous only mode. No hot-path allocations for
fundamental types, enums and strings (including `std::string` and `std::string_view`). Any other custom or user
defined type gets copy constructed with the formatting done on a backend worker thread.
- **Convenience** Ease application monitoring/debugging. Latency is equal to latencies of binary loggers, but the
produced log is in human readable form.

## Features
- Log anything - Blazing fast. See [Benchmarks](https://github.com/odygrd/quill#performance).
- Format outside of the hot-path in a backend logging thread. For `non-built-in` types `ostream::operator<<()` is called on a copy of the object by the backend logging thread. Unsafe to copy `non-trivial user defined` are detected in compile time. Those types can be tagged as `safe-to-copy` to avoid formatting them on the hot path. See [User Defined Types](https://github.com/odygrd/quill/wiki/8.-User-Defined-Types).
- Custom formatters. Logs can be formatted based on a user specified pattern. See [Formatters](https://github.com/odygrd/quill/wiki/4.-Formatters).

- Log anything - Blazing fast. See [Benchmarks](https://github.com/odygrd/quill#performance).
- Format outside the hot-path in a backend logging thread. For `non-built-in` types `ostream::operator<<()` is called on
a copy of the object by the backend logging thread. Unsafe to copy `non-trivial user defined` are detected in compile
time. Those types can be tagged as `safe-to-copy` to avoid formatting them on the hot path.
See [User Defined Types](https://github.com/odygrd/quill/wiki/8.-User-Defined-Types).
- Custom formatters. Logs can be formatted based on a user specified pattern.
See [Formatters](https://github.com/odygrd/quill/wiki/4.-Formatters).
- Support for log stack traces. Store log messages in a ring buffer and display later on a higher severity log statement or on demand. See [Backtrace Logging](https://github.com/odygrd/quill/wiki/6.-Backtrace-Logging).
- Various logging targets. See [Handlers](https://github.com/odygrd/quill/wiki/2.-Handlers).
- Console logging with colours support.
Expand All @@ -83,9 +99,11 @@ The main goals of the library are:
- Time rotating log files
- Custom Handlers
- Filters for filtering log messages. See [Filters](https://github.com/odygrd/quill/wiki/3.-Filters).
- `guaranteed non-blocking` or `non-guaranteed` logging. In `non-guaranteed` mode there is no heap allocation of a new queue but log messages can be dropped. See [FAQ](https://github.com/odygrd/quill/wiki/7.-FAQ#guaranteed-logging-mode).
- Support for wide character logging and wide character filenames (Windows only).
- Log statements in timestamp order even when produced by different threads. This makes debugging easier in multi-threaded applications.
- `guaranteed non-blocking` or `non-guaranteed` logging. In `non-guaranteed` mode there is no heap allocation of a new
queue but log messages can be dropped. See [FAQ](https://github.com/odygrd/quill/wiki/7.-FAQ#guaranteed-logging-mode).
- Support for wide character logging and wide character filenames (Windows and v1.7.x only).
- Log statements in timestamp order even when produced by different threads. This makes debugging easier in
multi-threaded applications.
- Log levels can be completely stripped out at compile time reducing `if` branches.
- Clean warning-free codebase even on high warning levels.
- Crash safe behaviour with a build-in signal handler.
Expand All @@ -102,67 +120,67 @@ The results in the tables below are in nanoseconds (ns).

#### 1 Thread

| Library | 50th | 75th | 90th | 95th | 99th | 99.9th | Worst |
|--------------------|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:---------:|
|[Quill, Dual Queue Enabled, Bounded Queue](https://github.com/odygrd/quill) | 20 | 21 | 23 | 24 | 27 | 32 | 46 |
|[Quill, Dual Queue Enabled, Unbounded Queue](https://github.com/odygrd/quill) | 21 | 22 | 24 | 25 | 28 | 34 | 54 |
|[Quill, Dual Queue Disabled, Unbounded Queue](https://github.com/odygrd/quill) | 16 | 18 | 21 | 22 | 28 | 39 | 58 |
|[PlatformLab NanoLog](https://github.com/PlatformLab/NanoLog) | 52 | 66 | 76 | 81 | 92 | 107 | 192 |
|[MS BinLog](https://github.com/Morgan-Stanley/binlog) | 39 | 41 | 43 | 44 | 67 | 110 | 216 |
|[fmtlog](https://github.com/MengRao/fmtlog) | 16 | 18 | 20 | 21 | 26 | 36 | 47 |
|[Reckless](https://github.com/mattiasflodin/reckless) | 62 | 72 | 79 | 87 | 107 | 126 | 168 |
|[Iyengar NanoLog](https://github.com/Iyengar111/NanoLog) | 147 | 169 | 187 | 209 | 283 | 376 | 33623 |
|[spdlog](https://github.com/gabime/spdlog) | 626 | 675 | 721 | 755 | 877 | 1026 | 1206 |
|[g3log](https://github.com/KjellKod/g3log) | 5551 | 5759 | 5962 | 6090 | 6338 | 6647 | 7133 |
| Library | 50th | 75th | 90th | 95th | 99th | 99.9th | Worst |
|--------------------------------------------------------------------------------|:----:|:----:|:----:|:----:|:----:|:------:|:-----:|
| [Quill, Dual Queue Enabled, Bounded Queue](https://github.com/odygrd/quill) | 20 | 21 | 23 | 24 | 27 | 32 | 46 |
| [Quill, Dual Queue Enabled, Unbounded Queue](https://github.com/odygrd/quill) | 21 | 22 | 24 | 25 | 28 | 34 | 54 |
| [Quill, Dual Queue Disabled, Unbounded Queue](https://github.com/odygrd/quill) | 16 | 18 | 21 | 22 | 28 | 39 | 58 |
| [PlatformLab NanoLog](https://github.com/PlatformLab/NanoLog) | 52 | 66 | 76 | 81 | 92 | 107 | 192 |
| [MS BinLog](https://github.com/Morgan-Stanley/binlog) | 39 | 41 | 43 | 44 | 67 | 110 | 216 |
| [fmtlog](https://github.com/MengRao/fmtlog) | 16 | 18 | 20 | 21 | 26 | 36 | 47 |
| [Reckless](https://github.com/mattiasflodin/reckless) | 62 | 72 | 79 | 87 | 107 | 126 | 168 |
| [Iyengar NanoLog](https://github.com/Iyengar111/NanoLog) | 147 | 169 | 187 | 209 | 283 | 376 | 33623 |
| [spdlog](https://github.com/gabime/spdlog) | 626 | 675 | 721 | 755 | 877 | 1026 | 1206 |
| [g3log](https://github.com/KjellKod/g3log) | 5551 | 5759 | 5962 | 6090 | 6338 | 6647 | 7133 |

#### 4 Threads

| Library | 50th | 75th | 90th | 95th | 99th | 99.9th | Worst |
|--------------------|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:---------:|
|[Quill, Dual Queue Enabled, Bounded Queue](https://github.com/odygrd/quill) | 20 | 21 | 23 | 24 | 27 | 38 | 59 |
|[Quill, Dual Queue Enabled, Unbounded Queue](https://github.com/odygrd/quill) | 21 | 23 | 25 | 27 | 32 | 43 | 64 |
|[Quill, Dual Queue Disabled, Unbounded Queue](https://github.com/odygrd/quill) | 16 | 19 | 21 | 23 | 30 | 39 | 57 |
|[PlatformLab NanoLog](https://github.com/PlatformLab/NanoLog) | 53 | 67 | 77 | 82 | 93 | 131 | 236 |
|[MS BinLog](https://github.com/Morgan-Stanley/binlog) | 39 | 42 | 43 | 46 | 73 | 119 | 243 |
|[fmtlog](https://github.com/MengRao/fmtlog) | 16 | 18 | 19 | 21 | 25 | 34 | 53 |
|[Reckless](https://github.com/mattiasflodin/reckless) | 46 | 60 | 75 | 88 | 112 | 156 | 262 |
|[Iyengar NanoLog](https://github.com/Iyengar111/NanoLog) | 140 | 173 | 239 | 273 | 336 | 432 | 43605 |
|[spdlog](https://github.com/gabime/spdlog) | 665 | 742 | 825 | 880 | 1069 | 1395 | 2087 |
|[g3log](https://github.com/KjellKod/g3log) | 5294 | 5532 | 5759 | 5901 | 6179 | 6521 | 7443 |
| Library | 50th | 75th | 90th | 95th | 99th | 99.9th | Worst |
|--------------------------------------------------------------------------------|:----:|:----:|:----:|:----:|:----:|:------:|:-----:|
| [Quill, Dual Queue Enabled, Bounded Queue](https://github.com/odygrd/quill) | 20 | 21 | 23 | 24 | 27 | 38 | 59 |
| [Quill, Dual Queue Enabled, Unbounded Queue](https://github.com/odygrd/quill) | 21 | 23 | 25 | 27 | 32 | 43 | 64 |
| [Quill, Dual Queue Disabled, Unbounded Queue](https://github.com/odygrd/quill) | 16 | 19 | 21 | 23 | 30 | 39 | 57 |
| [PlatformLab NanoLog](https://github.com/PlatformLab/NanoLog) | 53 | 67 | 77 | 82 | 93 | 131 | 236 |
| [MS BinLog](https://github.com/Morgan-Stanley/binlog) | 39 | 42 | 43 | 46 | 73 | 119 | 243 |
| [fmtlog](https://github.com/MengRao/fmtlog) | 16 | 18 | 19 | 21 | 25 | 34 | 53 |
| [Reckless](https://github.com/mattiasflodin/reckless) | 46 | 60 | 75 | 88 | 112 | 156 | 262 |
| [Iyengar NanoLog](https://github.com/Iyengar111/NanoLog) | 140 | 173 | 239 | 273 | 336 | 432 | 43605 |
| [spdlog](https://github.com/gabime/spdlog) | 665 | 742 | 825 | 880 | 1069 | 1395 | 2087 |
| [g3log](https://github.com/KjellKod/g3log) | 5294 | 5532 | 5759 | 5901 | 6179 | 6521 | 7443 |

### Log Numbers and Large Strings
The following message is logged 100'000 times per thread ```LOG_INFO(logger, "Logging int: {}, int: {}, string: {}", i, j, large_string)```.
The large string is over 35 characters to avoid short string optimisation of `std::string`

#### 1 Thread

| Library | 50th | 75th | 90th | 95th | 99th | 99.9th | Worst |
|--------------------|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:---------:|
|[Quill, Dual Queue Enabled, Bounded Queue](https://github.com/odygrd/quill) | 26 | 27 | 30 | 31 | 36 | 47 | 65 |
|[Quill, Dual Queue Enabled, Unbounded Queue](https://github.com/odygrd/quill) | 25 | 26 | 28 | 30 | 35 | 47 | 70 |
|[Quill, Dual Queue Disabled, Unbounded Queue](https://github.com/odygrd/quill) | 116 | 132 | 145 | 153 | 168 | 185 | 214 |
|[PlatformLab NanoLog](https://github.com/PlatformLab/NanoLog) | 35 | 36 | 37 | 39 | 46 | 53 | 70 |
|[MS BinLog](https://github.com/Morgan-Stanley/binlog) | 52 | 53 | 56 | 60 | 80 | 133 | 251 |
|[fmtlog](https://github.com/MengRao/fmtlog) | 35 | 37 | 40 | 42 | 47 | 55 | 181 |
|[Reckless](https://github.com/mattiasflodin/reckless) | 211 | 236 | 262 | 280 | 317 | 522 | 1051 |
|[Iyengar NanoLog](https://github.com/Iyengar111/NanoLog) | 157 | 176 | 196 | 220 | 290 | 372 | 22812 |
|[spdlog](https://github.com/gabime/spdlog) | 652 | 715 | 775 | 827 | 953 | 1082 | 1453 |
|[g3log](https://github.com/KjellKod/g3log) | 4563 | 4752 | 4942 | 5066 | 5309 | 5633 | 6188 |
| Library | 50th | 75th | 90th | 95th | 99th | 99.9th | Worst |
|--------------------------------------------------------------------------------|:----:|:----:|:----:|:----:|:----:|:------:|:-----:|
| [Quill, Dual Queue Enabled, Bounded Queue](https://github.com/odygrd/quill) | 26 | 27 | 30 | 31 | 36 | 47 | 65 |
| [Quill, Dual Queue Enabled, Unbounded Queue](https://github.com/odygrd/quill) | 25 | 26 | 28 | 30 | 35 | 47 | 70 |
| [Quill, Dual Queue Disabled, Unbounded Queue](https://github.com/odygrd/quill) | 116 | 132 | 145 | 153 | 168 | 185 | 214 |
| [PlatformLab NanoLog](https://github.com/PlatformLab/NanoLog) | 35 | 36 | 37 | 39 | 46 | 53 | 70 |
| [MS BinLog](https://github.com/Morgan-Stanley/binlog) | 52 | 53 | 56 | 60 | 80 | 133 | 251 |
| [fmtlog](https://github.com/MengRao/fmtlog) | 35 | 37 | 40 | 42 | 47 | 55 | 181 |
| [Reckless](https://github.com/mattiasflodin/reckless) | 211 | 236 | 262 | 280 | 317 | 522 | 1051 |
| [Iyengar NanoLog](https://github.com/Iyengar111/NanoLog) | 157 | 176 | 196 | 220 | 290 | 372 | 22812 |
| [spdlog](https://github.com/gabime/spdlog) | 652 | 715 | 775 | 827 | 953 | 1082 | 1453 |
| [g3log](https://github.com/KjellKod/g3log) | 4563 | 4752 | 4942 | 5066 | 5309 | 5633 | 6188 |

#### 4 Threads

| Library | 50th | 75th | 90th | 95th | 99th | 99.9th | Worst |
|--------------------|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:---------:|
|[Quill, Dual Queue Enabled, Bounded Queue](https://github.com/odygrd/quill) | 25 | 27 | 29 | 31 | 39 | 51 | 86 |
|[Quill, Dual Queue Enabled, Unbounded Queue](https://github.com/odygrd/quill) | 25 | 27 | 29 | 30 | 37 | 53 | 83 |
|[Quill, Dual Queue Disabled, Unbounded Queue](https://github.com/odygrd/quill) | 125 | 138 | 151 | 160 | 176 | 192 | 247 |
|[PlatformLab NanoLog](https://github.com/PlatformLab/NanoLog) | 34 | 35 | 36 | 38 | 45 | 53 | 100 |
|[MS BinLog](https://github.com/Morgan-Stanley/binlog) | 51 | 53 | 55 | 60 | 85 | 128 | 243 |
|[fmtlog](https://github.com/MengRao/fmtlog) | 34 | 36 | 38 | 41 | 47 | 55 | 371 |
|[Reckless](https://github.com/mattiasflodin/reckless) | 184 | 204 | 226 | 240 | 283 | 531 | 761 |
|[Iyengar NanoLog](https://github.com/Iyengar111/NanoLog) | 151 | 218 | 267 | 296 | 353 | 469 | 71636 |
|[spdlog](https://github.com/gabime/spdlog) | 640 | 710 | 795 | 867 | 1097 | 1465 | 2259 |
|[g3log](https://github.com/KjellKod/g3log) | 3575 | 3776 | 3967 | 4089 | 4332 | 4650 | 5544 |
| Library | 50th | 75th | 90th | 95th | 99th | 99.9th | Worst |
|--------------------------------------------------------------------------------|:----:|:----:|:----:|:----:|:----:|:------:|:-----:|
| [Quill, Dual Queue Enabled, Bounded Queue](https://github.com/odygrd/quill) | 25 | 27 | 29 | 31 | 39 | 51 | 86 |
| [Quill, Dual Queue Enabled, Unbounded Queue](https://github.com/odygrd/quill) | 25 | 27 | 29 | 30 | 37 | 53 | 83 |
| [Quill, Dual Queue Disabled, Unbounded Queue](https://github.com/odygrd/quill) | 125 | 138 | 151 | 160 | 176 | 192 | 247 |
| [PlatformLab NanoLog](https://github.com/PlatformLab/NanoLog) | 34 | 35 | 36 | 38 | 45 | 53 | 100 |
| [MS BinLog](https://github.com/Morgan-Stanley/binlog) | 51 | 53 | 55 | 60 | 85 | 128 | 243 |
| [fmtlog](https://github.com/MengRao/fmtlog) | 34 | 36 | 38 | 41 | 47 | 55 | 371 |
| [Reckless](https://github.com/mattiasflodin/reckless) | 184 | 204 | 226 | 240 | 283 | 531 | 761 |
| [Iyengar NanoLog](https://github.com/Iyengar111/NanoLog) | 151 | 218 | 267 | 296 | 353 | 469 | 71636 |
| [spdlog](https://github.com/gabime/spdlog) | 640 | 710 | 795 | 867 | 1097 | 1465 | 2259 |
| [g3log](https://github.com/KjellKod/g3log) | 3575 | 3776 | 3967 | 4089 | 4332 | 4650 | 5544 |

The benchmarks are done on `Ubuntu - Intel(R) Xeon(R) Gold 6254 CPU @ 3.10GHz` with GCC 11.2

Expand Down

0 comments on commit 6b0941b

Please sign in to comment.