Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gabime/spdlog
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c8792f66fa89f1a8fec31d94f8a9ddde5d586734
Choose a base ref
..
head repository: gabime/spdlog
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 85a05357aed30021f115eb2c3160adf86e3d259d
Choose a head ref
Showing with 2,468 additions and 4,590 deletions.
  1. +3 −5 .clang-tidy
  2. +0 −79 .github/workflows/ci.yml
  3. +61 −0 .github/workflows/linux.yml
  4. +26 −0 .github/workflows/macos.yml
  5. +113 −0 .github/workflows/windows.yml
  6. +202 −303 CMakeLists.txt
  7. +13 −44 README.md
  8. +0 −79 appveyor.yml
  9. +1 −1 bench/CMakeLists.txt
  10. +46 −38 bench/async_bench.cpp
  11. +24 −31 bench/bench.cpp
  12. +21 −65 bench/latency.cpp
  13. +8 −8 cmake/fmtlib.cmake
  14. +0 −12 cmake/spdlog.pc.in
  15. +1 −4 cmake/spdlogConfig.cmake.in
  16. +0 −35 cmake/spdlog_config.h.in
  17. +12 −1 cmake/utils.cmake
  18. +2 −2 example/CMakeLists.txt
  19. +44 −108 example/example.cpp
  20. +0 −88 include/spdlog/async.h
  21. +0 −69 include/spdlog/async_logger.h
  22. +10 −24 include/spdlog/{fmt → }/bin_to_hex.h
  23. +0 −37 include/spdlog/cfg/argv.h
  24. +0 −36 include/spdlog/cfg/env.h
  25. +0 −25 include/spdlog/cfg/helpers.h
  26. +29 −168 include/spdlog/common.h
  27. +35 −0 include/spdlog/details/async_log_msg.h
  28. +0 −2 include/spdlog/details/circular_q.h
  29. +31 −0 include/spdlog/details/err_helper.h
  30. +5 −19 include/spdlog/details/file_helper.h
  31. +21 −46 include/spdlog/details/fmt_helper.h
  32. +4 −4 include/spdlog/details/log_msg.h
  33. +0 −28 include/spdlog/details/log_msg_buffer.h
  34. +10 −15 include/spdlog/details/mpmc_blocking_q.h
  35. +0 −1 include/spdlog/details/null_mutex.h
  36. +48 −25 include/spdlog/details/os.h
  37. +0 −57 include/spdlog/details/periodic_worker.h
  38. +0 −120 include/spdlog/details/registry.h
  39. +0 −22 include/spdlog/details/synchronous_factory.h
  40. +0 −112 include/spdlog/details/thread_pool.h
  41. +20 −0 include/spdlog/file_event_handlers.h
  42. +18 −0 include/spdlog/filename_t.h
  43. +0 −18 include/spdlog/fmt/fmt.h
  44. +72 −140 include/spdlog/logger.h
  45. +0 −34 include/spdlog/mdc.h
  46. +1 −1 include/spdlog/pattern_formatter.h
  47. +1 −15 include/spdlog/sinks/android_sink.h
  48. +35 −34 include/spdlog/sinks/ansicolor_sink.h
  49. +111 −0 include/spdlog/sinks/async_sink.h
  50. +6 −5 include/spdlog/sinks/base_sink.h
  51. +0 −21 include/spdlog/sinks/basic_file_sink.h
  52. +1 −16 include/spdlog/sinks/callback_sink.h
  53. +15 −67 include/spdlog/sinks/daily_file_sink.h
  54. +3 −3 include/spdlog/sinks/dist_sink.h
  55. +1 −1 include/spdlog/sinks/dup_filter_sink.h
  56. +14 −33 include/spdlog/sinks/hourly_file_sink.h
  57. +0 −23 include/spdlog/sinks/kafka_sink.h
  58. +3 −22 include/spdlog/sinks/mongo_sink.h
  59. +2 −2 include/spdlog/sinks/msvc_sink.h
  60. +0 −16 include/spdlog/sinks/null_sink.h
  61. +1 −67 include/spdlog/sinks/qt_sinks.h
  62. +7 −5 include/spdlog/sinks/ringbuffer_sink.h
  63. +4 −31 include/spdlog/sinks/rotating_file_sink.h
  64. +3 −3 include/spdlog/sinks/sink.h
  65. +1 −17 include/spdlog/sinks/stdout_color_sinks.h
  66. +1 −15 include/spdlog/sinks/stdout_sinks.h
  67. +8 −28 include/spdlog/sinks/syslog_sink.h
  68. +7 −29 include/spdlog/sinks/systemd_sink.h
  69. +1 −1 include/spdlog/sinks/tcp_sink.h
  70. +2 −11 include/spdlog/sinks/udp_sink.h
  71. +6 −6 include/spdlog/sinks/win_eventlog_sink.h
  72. +1 −1 include/spdlog/sinks/wincolor_sink.h
  73. +2 −30 include/spdlog/source_loc.h
  74. +50 −160 include/spdlog/spdlog.h
  75. +3 −12 include/spdlog/stopwatch.h
  76. +1 −1 logos/jetbrains-variant-4.svg
  77. +0 −8 scripts/format.sh
  78. +0 −75 src/async_logger.cpp
  79. +0 −99 src/cfg/helpers.cpp
  80. +3 −7 src/common.cpp
  81. +64 −0 src/details/async_log_msg.cpp
  82. +68 −0 src/details/err_helper.cpp
  83. +13 −41 src/details/file_helper.cpp
  84. +31 −35 src/details/log_msg.cpp
  85. +0 −54 src/details/log_msg_buffer.cpp
  86. +64 −0 src/details/os_filesystem.cpp
  87. +18 −60 src/details/os_unix.cpp
  88. +26 −103 src/details/os_windows.cpp
  89. +0 −22 src/details/periodic_worker.cpp
  90. +0 −266 src/details/registry.cpp
  91. +0 −117 src/details/thread_pool.cpp
  92. +21 −42 src/logger.cpp
  93. +81 −130 src/pattern_formatter.cpp
  94. +21 −17 src/sinks/ansicolor_sink.cpp
  95. +158 −0 src/sinks/async_sink.cpp
  96. +17 −12 src/sinks/base_sink.cpp
  97. +3 −0 src/sinks/basic_file_sink.cpp
  98. +17 −10 src/sinks/rotating_file_sink.cpp
  99. +0 −16 src/sinks/sink.cpp
  100. +0 −57 src/sinks/stdout_color_sinks.cpp
  101. +6 −49 src/sinks/stdout_sinks.cpp
  102. +3 −6 src/sinks/wincolor_sink.cpp
  103. +17 −37 src/spdlog.cpp
  104. +13 −18 tests/CMakeLists.txt
  105. +5 −1 tests/includes.h
  106. +252 −89 tests/test_async.cpp
  107. +1 −2 tests/test_attributes.cpp
  108. +2 −1 tests/test_bin_to_hex.cpp
  109. +0 −168 tests/test_cfg.cpp
  110. +62 −7 tests/test_create_dir.cpp
  111. +0 −2 tests/test_custom_callbacks.cpp
  112. +28 −30 tests/test_daily_and_rotation_loggers.cpp
  113. +50 −71 tests/test_errors.cpp
  114. +5 −5 tests/test_file_helper.cpp
  115. +24 −18 tests/test_file_logging.cpp
  116. +0 −1 tests/test_fmt_helper.cpp
  117. +3 −4 tests/test_macros.cpp
  118. +145 −33 tests/test_misc.cpp
  119. +1 −0 tests/test_mpmc_q.cpp
  120. +22 −0 tests/test_no_source_location.cpp
  121. +1 −120 tests/test_pattern_formatter.cpp
  122. +0 −131 tests/test_registry.cpp
  123. +2 −2 tests/test_ringbuffer_sink.cpp
  124. +17 −3 tests/test_sink.h
  125. +16 −15 tests/test_source_location.cpp
  126. +6 −12 tests/test_stdout_api.cpp
  127. +0 −2 tests/test_time_point.cpp
  128. +5 −7 tests/utils.cpp
  129. +6 −4 tests/utils.h
8 changes: 3 additions & 5 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -23,16 +23,15 @@ clang-analyzer-*,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-readability-named-parameter,
-cert-env33-c,
-modernize-concat-nested-namespaces
-modernize-concat-nested-namespaces,
-cppcoreguidelines-owning-memory
'


WarningsAsErrors: ''
HeaderFilterRegex: '*spdlog/[^f].*'
AnalyzeTemporaryDtors: false
FormatStyle: none

CheckOptions:
CheckOptions:
- key: google-readability-braces-around-statements.ShortStatementLines
value: '1'
- key: google-readability-function-size.StatementThreshold
@@ -53,4 +52,3 @@ CheckOptions:
value: llvm
- key: modernize-use-nullptr.NullMacros
value: 'NULL'

79 changes: 0 additions & 79 deletions .github/workflows/ci.yml

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: linux

on: [push, pull_request]

permissions:
contents: read

jobs:
# -----------------------------------------------------------------------
# Linux build matrix
# -----------------------------------------------------------------------
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
config:
- { compiler: gcc, version: 9, build_type: Release, cppstd: 17 }
- { compiler: gcc, version: 11, build_type: Debug, cppstd: 20 }
- { compiler: gcc, version: 12, build_type: Release, cppstd: 20 }
- { compiler: gcc, version: 12, build_type: Debug, cppstd: 20, asan: ON }
- { compiler: clang, version: 12, build_type: Debug, cppstd: 17 }
- { compiler: clang, version: 15, build_type: Debug, cppstd: 20, tsan: ON }
container:
image: ${{ matrix.config.compiler == 'clang' && 'teeks99/clang-ubuntu' || matrix.config.compiler }}:${{ matrix.config.version }}
name: "${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }} ${{ matrix.config.build_type }} ${{ matrix.config.asan == 'ON' && 'ASAN' || '' }}${{ matrix.config.tsan == 'ON' && 'TSAN' || '' }})"
steps:
- uses: actions/checkout@v4
- name: Setup
run: |
apt-get update
apt-get install -y curl git pkg-config libsystemd-dev
CMAKE_VERSION="3.24.2"
curl -sSL https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh -o install-cmake.sh
chmod +x install-cmake.sh
./install-cmake.sh --prefix=/usr/local --skip-license
- name: Setup Compiler
if: matrix.config.compiler == 'clang'
run: |
scripts/ci_setup_clang.sh "${{ matrix.config.version }}"
echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV
echo "CC=clang-${{ matrix.config.version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.config.version }}" >> $GITHUB_ENV
- name: Build
run: |
mkdir -p build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-DCMAKE_CXX_STANDARD=${{ matrix.config.cppstd }} \
-DSPDLOG_BUILD_EXAMPLE=${{ matrix.config.examples || 'ON' }} \
-DSPDLOG_BUILD_WARNINGS=ON \
-DSPDLOG_BUILD_BENCH=OFF \
-DSPDLOG_BUILD_TESTS=ON \
-DSPDLOG_SANITIZE_ADDRESS=${{ matrix.config.asan || 'OFF' }} \
-DSPDLOG_SANITIZE_ADDRESS=${{ matrix.config.asan || 'OFF' }} \
-DSPDLOG_SANITIZE_THREAD=${{ matrix.config.tsan || 'OFF' }}
make -j 4
ctest -j 4 --output-on-failure
26 changes: 26 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: macos

on: [push, pull_request]

permissions:
contents: read

jobs:
build:
runs-on: macOS-latest
name: "macOS Clang (C++17, Release)"
steps:
- uses: actions/checkout@v4
- name: Build
run: |
mkdir -p build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=17 \
-DSPDLOG_BUILD_EXAMPLE=ON \
-DSPDLOG_BUILD_WARNINGS=ON \
-DSPDLOG_BUILD_BENCH=OFF \
-DSPDLOG_BUILD_TESTS=ON \
-DSPDLOG_SANITIZE_ADDRESS=OFF
make -j 4
ctest -j 4 --output-on-failure
113 changes: 113 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: windows

on: [push, pull_request]

permissions:
contents: read

jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
config:
- GENERATOR: "Visual Studio 17 2022"
BUILD_TYPE: Release
BUILD_SHARED: 'ON'
FATAL_ERRORS: 'ON'
BUILD_EXAMPLE: 'OFF'
CXX_STANDARD: 20
- GENERATOR: "Visual Studio 17 2022"
BUILD_TYPE: Release
BUILD_SHARED: 'ON'
FATAL_ERRORS: 'ON'
BUILD_EXAMPLE: 'OFF'
CXX_STANDARD: 17
- GENERATOR: "Visual Studio 17 2022"
BUILD_TYPE: Release
BUILD_SHARED: 'OFF'
FATAL_ERRORS: 'ON'
BUILD_EXAMPLE: 'ON'
CXX_STANDARD: 17

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: CMake ${{ matrix.config.GENERATOR }} CXX=${{matrix.config.CXX_STANDARD}}
shell: pwsh
run: |
mkdir build
cd build
cmake -G "${{ matrix.config.GENERATOR }}" -A x64 `
-D CMAKE_BUILD_TYPE=${{ matrix.config.BUILD_TYPE }} `
-D BUILD_SHARED_LIBS=${{ matrix.config.BUILD_SHARED }} `
-D SPDLOG_BUILD_EXAMPLE=${{ matrix.config.BUILD_EXAMPLE }} `
-D SPDLOG_BUILD_TESTS=ON `
-D SPDLOG_BUILD_WARNINGS=${{ matrix.config.FATAL_ERRORS }} `
-D CMAKE_CXX_STANDARD=${{ matrix.config.CXX_STANDARD }} ..
- name: Build
shell: pwsh
run: |
cd build
cmake --build . --parallel --config ${{ matrix.config.BUILD_TYPE }}
- name: Run Tests
shell: pwsh
env:
PATH: ${{ env.PATH }};${{ github.workspace }}\build\_deps\catch2-build\src\${{ matrix.config.BUILD_TYPE }};${{ github.workspace }}\build\bin\${{ matrix.config.BUILD_TYPE }}
run: ${{ github.workspace }}\build\bin\${{ matrix.config.BUILD_TYPE }}\spdlog-utests.exe


# -----------------------------------------------------------------------
# MSVC 2019 build matrix
# -----------------------------------------------------------------------
build_2019:
runs-on: windows-2019
strategy:
fail-fast: true
matrix:
config:
- GENERATOR: "Visual Studio 16 2019"
BUILD_TYPE: Release
BUILD_SHARED: 'ON'
FATAL_ERRORS: 'ON'
BUILD_EXAMPLE: 'ON'
CXX_STANDARD: 17
- GENERATOR: "Visual Studio 16 2019"
BUILD_TYPE: Release
BUILD_SHARED: 'ON'
FATAL_ERRORS: 'ON'
BUILD_EXAMPLE: 'ON'
CXX_STANDARD: 20

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: CMake ${{ matrix.config.GENERATOR }} CXX=${{matrix.config.CXX_STANDARD}}
shell: pwsh
run: |
mkdir build
cd build
cmake -G "${{ matrix.config.GENERATOR }}" -A x64 `
-D CMAKE_BUILD_TYPE=${{ matrix.config.BUILD_TYPE }} `
-D BUILD_SHARED_LIBS=${{ matrix.config.BUILD_SHARED }} `
-D SPDLOG_BUILD_EXAMPLE=${{ matrix.config.BUILD_EXAMPLE }} `
-D SPDLOG_BUILD_TESTS=ON `
-D SPDLOG_BUILD_WARNINGS=${{ matrix.config.FATAL_ERRORS }} `
-D CMAKE_CXX_STANDARD=${{ matrix.config.CXX_STANDARD }} ..
- name: Build
shell: pwsh
run: |
cd build
cmake --build . --parallel --config ${{ matrix.config.BUILD_TYPE }}
- name: Run Tests
shell: pwsh
env:
PATH: ${{ env.PATH }};${{ github.workspace }}\build\_deps\catch2-build\src\${{ matrix.config.BUILD_TYPE }};${{ github.workspace }}\build\bin\${{ matrix.config.BUILD_TYPE }}
run: ${{ github.workspace }}\build\bin\${{ matrix.config.BUILD_TYPE }}\spdlog-utests.exe
Loading