Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also 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: v1.13.0
Choose a base ref
...
head repository: gabime/spdlog
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.x
Choose a head ref
Loading
Showing with 9,795 additions and 8,260 deletions.
  1. +0 −1 .clang-tidy
  2. +27 −18 .github/workflows/{ci.yml → linux.yml}
  3. +38 −0 .github/workflows/macos.yml
  4. +148 −0 .github/workflows/windows.yml
  5. +3 −0 .gitignore
  6. +157 −113 CMakeLists.txt
  7. +13 −10 INSTALL
  8. +33 −5 README.md
  9. +1 −1 bench/async_bench.cpp
  10. +2 −2 bench/bench.cpp
  11. +1 −1 bench/latency.cpp
  12. +13 −2 cmake/utils.cmake
  13. +28 −3 example/example.cpp
  14. +2 −2 include/spdlog/cfg/env.h
  15. +3 −8 include/spdlog/common.h
  16. +2 −0 include/spdlog/details/circular_q.h
  17. +3 −2 include/spdlog/details/file_helper-inl.h
  18. +3 −3 include/spdlog/details/mpmc_blocking_q.h
  19. +29 −8 include/spdlog/details/os-inl.h
  20. +4 −0 include/spdlog/details/os.h
  21. +1 −0 include/spdlog/details/periodic_worker.h
  22. +0 −4 include/spdlog/details/registry-inl.h
  23. +8 −1 include/spdlog/details/registry.h
  24. +1 −1 include/spdlog/fmt/bin_to_hex.h
  25. +80 −94 include/spdlog/fmt/bundled/args.h
  26. +2,961 −0 include/spdlog/fmt/bundled/base.h
  27. +1,041 −772 include/spdlog/fmt/bundled/chrono.h
  28. +131 −172 include/spdlog/fmt/bundled/color.h
  29. +114 −174 include/spdlog/fmt/bundled/compile.h
  30. +4 −3,322 include/spdlog/fmt/bundled/core.h
  31. +467 −241 include/spdlog/fmt/bundled/format-inl.h
  32. +2,093 −2,076 include/spdlog/fmt/bundled/format.h
  33. +0 −2 include/spdlog/fmt/bundled/locale.h
  34. +140 −191 include/spdlog/fmt/bundled/os.h
  35. +78 −149 include/spdlog/fmt/bundled/ostream.h
  36. +284 −291 include/spdlog/fmt/bundled/printf.h
  37. +480 −352 include/spdlog/fmt/bundled/ranges.h
  38. +629 −74 include/spdlog/fmt/bundled/std.h
  39. +241 −97 include/spdlog/fmt/bundled/xchar.h
  40. +0 −4 include/spdlog/fmt/fmt.h
  41. +50 −0 include/spdlog/mdc.h
  42. +71 −1 include/spdlog/pattern_formatter-inl.h
  43. +12 −6 include/spdlog/sinks/ansicolor_sink-inl.h
  44. +5 −4 include/spdlog/sinks/ansicolor_sink.h
  45. +4 −4 include/spdlog/sinks/base_sink.h
  46. +6 −0 include/spdlog/sinks/basic_file_sink-inl.h
  47. +1 −0 include/spdlog/sinks/basic_file_sink.h
  48. +1 −1 include/spdlog/sinks/callback_sink.h
  49. +2 −0 include/spdlog/sinks/daily_file_sink.h
  50. +2 −0 include/spdlog/sinks/hourly_file_sink.h
  51. +1 −1 include/spdlog/sinks/msvc_sink.h
  52. +1 −1 include/spdlog/sinks/null_sink.h
  53. +3 −3 include/spdlog/sinks/qt_sinks.h
  54. +7 −1 include/spdlog/sinks/rotating_file_sink-inl.h
  55. +1 −0 include/spdlog/sinks/rotating_file_sink.h
  56. +5 −4 include/spdlog/sinks/stdout_sinks-inl.h
  57. +3 −2 include/spdlog/sinks/syslog_sink.h
  58. +9 −0 include/spdlog/sinks/wincolor_sink-inl.h
  59. +4 −0 include/spdlog/stopwatch.h
  60. +7 −0 include/spdlog/tweakme.h
  61. +2 −2 include/spdlog/version.h
  62. +19 −16 src/bundled_fmtlib_format.cpp
  63. +6 −7 tests/CMakeLists.txt
  64. +6 −0 tests/includes.h
  65. +9 −0 tests/test_cfg.cpp
  66. +61 −0 tests/test_create_dir.cpp
  67. +2 −1 tests/test_custom_callbacks.cpp
  68. +3 −5 tests/test_daily_logger.cpp
  69. +1 −1 tests/test_errors.cpp
  70. +1 −1 tests/test_file_helper.cpp
  71. +40 −0 tests/test_file_logging.cpp
  72. +55 −2 tests/test_misc.cpp
  73. +130 −0 tests/test_pattern_formatter.cpp
  74. +2 −1 tests/test_sink.h
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -27,7 +27,6 @@ clang-analyzer-*,

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

CheckOptions:
45 changes: 27 additions & 18 deletions .github/workflows/ci.yml → .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
name: ci
name: linux

on: [push, pull_request]

permissions:
contents: read

jobs:
build_linux:
# -----------------------------------------------------------------------
# Linux build matrix
# -----------------------------------------------------------------------
build:
runs-on: ubuntu-latest
defaults:
run:
@@ -16,27 +22,27 @@ jobs:
- { 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: clang, version: 12, build_type: Debug, cppstd: 17, asan: OFF }
- { compiler: clang, version: 15, build_type: Release, cppstd: 20, asan: OFF }
- { 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: Release, 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 }})"
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@main
- uses: actions/checkout@v4
- name: Setup
run: |
apt-get update && apt-get install -y curl git pkg-config libsystemd-dev
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: |
if [[ "${{ matrix.config.version }}" -ge 4 ]]; then
scripts/ci_setup_clang.sh "${{ matrix.config.version }}"
echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV
fi
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
@@ -51,15 +57,19 @@ jobs:
-DSPDLOG_BUILD_BENCH=OFF \
-DSPDLOG_BUILD_TESTS=ON \
-DSPDLOG_BUILD_TESTS_HO=OFF \
-DSPDLOG_SANITIZE_ADDRESS=${{ matrix.config.asan || 'ON' }}
make -j2
ctest -j2 --output-on-failure
-DSPDLOG_SANITIZE_ADDRESS=${{ matrix.config.asan || 'OFF' }} \
-DSPDLOG_SANITIZE_THREAD=${{ matrix.config.tsan || 'OFF' }}
make -j 4
ctest -j 4 --output-on-failure
# -----------------------------------------------------------------------
# OS X build matrix
# -----------------------------------------------------------------------
build_osx:
runs-on: macOS-latest
name: "OS X Clang (C++11, Release)"
steps:
- uses: actions/checkout@main
- uses: actions/checkout@v4
- name: Build
run: |
mkdir -p build && cd build
@@ -73,6 +83,5 @@ jobs:
-DSPDLOG_BUILD_TESTS=ON \
-DSPDLOG_BUILD_TESTS_HO=OFF \
-DSPDLOG_SANITIZE_ADDRESS=OFF
make -j2
ctest -j2 --output-on-failure
make -j 4
ctest -j 4 --output-on-failure
38 changes: 38 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: macos

on: [push, pull_request]

permissions:
contents: read

jobs:
build:
runs-on: macOS-latest
name: "macOS Clang (C++11, Release)"
strategy:
fail-fast: true
matrix:
config:
- USE_STD_FORMAT: 'ON'
BUILD_EXAMPLE: 'OFF'
- USE_STD_FORMAT: 'OFF'
BUILD_EXAMPLE: 'ON'

steps:
- uses: actions/checkout@v4
- name: Build
run: |
mkdir -p build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=11 \
-DSPDLOG_BUILD_EXAMPLE=${{ matrix.config.BUILD_EXAMPLE }} \
-DSPDLOG_BUILD_EXAMPLE_HO=${{ matrix.config.BUILD_EXAMPLE }} \
-DSPDLOG_BUILD_WARNINGS=ON \
-DSPDLOG_BUILD_BENCH=OFF \
-DSPDLOG_BUILD_TESTS=ON \
-DSPDLOG_BUILD_TESTS_HO=OFF \
-DSPDLOG_USE_STD_FORMAT=${{ matrix.config.USE_STD_FORMAT }} \
-DSPDLOG_SANITIZE_ADDRESS=OFF
make -j 4
ctest -j 4 --output-on-failure
148 changes: 148 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: windows

on: [push, pull_request]

permissions:
contents: read

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

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

- name: CMake ${{ matrix.config.GENERATOR }} CXX=${{matrix.config.CXX_STANDARD}} WCHAR=${{matrix.config.WCHAR_FILES}} STD_FORMAT=${{matrix.config.USE_STD_FORMAT}}
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_WCHAR_SUPPORT=${{ matrix.config.WCHAR }} `
-D SPDLOG_WCHAR_FILENAMES=${{ matrix.config.WCHAR_FILES }} `
-D SPDLOG_BUILD_EXAMPLE=${{ matrix.config.BUILD_EXAMPLE }} `
-D SPDLOG_BUILD_EXAMPLE_HO=${{ matrix.config.BUILD_EXAMPLE }} `
-D SPDLOG_BUILD_TESTS=ON `
-D SPDLOG_BUILD_TESTS_HO=OFF `
-D SPDLOG_BUILD_WARNINGS=${{ matrix.config.FATAL_ERRORS }} `
-D SPDLOG_USE_STD_FORMAT=${{ matrix.config.USE_STD_FORMAT }} `
-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\${{ matrix.config.BUILD_TYPE }}
run: |
build\tests\${{ 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'
WCHAR: 'OFF'
WCHAR_FILES: 'OFF'
BUILD_EXAMPLE: 'ON'
USE_STD_FORMAT: 'OFF'
CXX_STANDARD: 17
- GENERATOR: "Visual Studio 16 2019"
BUILD_TYPE: Release
BUILD_SHARED: 'ON'
FATAL_ERRORS: 'ON'
WCHAR: 'OFF'
WCHAR_FILES: 'OFF'
BUILD_EXAMPLE: 'ON'
USE_STD_FORMAT: 'OFF'
CXX_STANDARD: 14
- GENERATOR: "Visual Studio 16 2019"
BUILD_TYPE: Release
BUILD_SHARED: 'ON'
FATAL_ERRORS: 'ON'
WCHAR: 'OFF'
WCHAR_FILES: 'OFF'
BUILD_EXAMPLE: 'ON'
USE_STD_FORMAT: 'OFF'
CXX_STANDARD: 11

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

- name: CMake ${{ matrix.config.GENERATOR }} CXX=${{matrix.config.CXX_STANDARD}} WCHAR=${{matrix.config.WCHAR_FILES}} STD_FORMAT=${{matrix.config.USE_STD_FORMAT}}
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_WCHAR_SUPPORT=${{ matrix.config.WCHAR }} `
-D SPDLOG_WCHAR_FILENAMES=${{ matrix.config.WCHAR_FILES }} `
-D SPDLOG_BUILD_EXAMPLE=${{ matrix.config.BUILD_EXAMPLE }} `
-D SPDLOG_BUILD_EXAMPLE_HO=${{ matrix.config.BUILD_EXAMPLE }} `
-D SPDLOG_BUILD_TESTS=ON `
-D SPDLOG_BUILD_TESTS_HO=OFF `
-D SPDLOG_BUILD_WARNINGS=${{ matrix.config.FATAL_ERRORS }} `
-D SPDLOG_USE_STD_FORMAT=${{ matrix.config.USE_STD_FORMAT }} `
-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\${{ matrix.config.BUILD_TYPE }}
run: |
build\tests\${{ matrix.config.BUILD_TYPE }}\spdlog-utests.exe
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -93,3 +93,6 @@ cmake-build-*/
# macos
*.DS_store
*.xcodeproj/
/.vs
/out/build
/CMakeSettings.json
Loading