Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,37 @@ jobs:
run: cmake -S tests/install_consumer -B build-consumer -DCMAKE_PREFIX_PATH=${{ github.workspace }}/install -DCMAKE_CXX_STANDARD=${{ matrix.std }}
- name: Build consumer project
run: cmake --build build-consumer
- name: Configure and install fmt dependency
if: matrix.std == 17
run: cmake -S external/fmt -B build-fmt -DFMT_TEST=OFF -DFMT_DOC=OFF -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install-fmt
- name: Build and install fmt dependency
if: matrix.std == 17
run: |
cmake --build build-fmt
cmake --install build-fmt
- name: Configure fmt-enabled package
if: matrix.std == 17
run: cmake -S . -B build-fmt-package -DLOGIT_CPP_BUILD_TESTS=OFF -DLOGIT_WITH_FMT=ON -DCMAKE_PREFIX_PATH=${{ github.workspace }}/install-fmt -DLOGIT_WITH_SYSLOG=OFF -DLOGIT_WITH_WIN_EVENT_LOG=OFF
- name: Install fmt-enabled package
if: matrix.std == 17
run: |
cmake --build build-fmt-package
cmake --install build-fmt-package --prefix install-fmt-package
- name: Configure fmt-enabled consumer project
if: matrix.std == 17
run: cmake -S tests/install_consumer -B build-fmt-consumer -DLOGIT_CONSUMER_REQUIRE_FMT=ON -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install-fmt-package;${{ github.workspace }}/install-fmt"
- name: Build fmt-enabled consumer project
if: matrix.std == 17
run: cmake --build build-fmt-consumer
- name: Configure Prometheus server package
if: matrix.std == 17
run: cmake -S . -B build-prometheus-package -DLOGIT_CPP_BUILD_TESTS=OFF -DLOGIT_WITH_PROMETHEUS_SERVER=ON -DLOGIT_WITH_SYSLOG=OFF -DLOGIT_WITH_WIN_EVENT_LOG=OFF
- name: Build Prometheus server package
if: matrix.std == 17
run: cmake --build build-prometheus-package
- name: Verify Prometheus server install guard
if: matrix.std == 17
run: cmake -DBUILD_DIR=${{ github.workspace }}/build-prometheus-package -DINSTALL_PREFIX=${{ github.workspace }}/install-prometheus -P tests/check_prometheus_server_install_guard.cmake
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v4
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "external/time-shield-cpp"]
path = external/time-shield-cpp
url = https://github.com/NewYaroslav/time-shield-cpp.git
url = https://github.com/LimiNode/time-shield-cpp.git
[submodule "external/fmt"]
path = external/fmt
url = https://github.com/fmtlib/fmt.git
Expand All @@ -15,7 +15,7 @@
url = https://github.com/madler/zlib
[submodule "external/mdbx-containers"]
path = external/mdbx-containers
url = https://github.com/NewYaroslav/mdbx-containers.git
url = https://github.com/LimiNode/mdbx-containers.git
[submodule "external/kurlyk"]
path = external/kurlyk
url = https://github.com/NewYaroslav/kurlyk.git
url = https://github.com/LimiNode/kurlyk.git
31 changes: 31 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,37 @@ These headers prepare internal dependencies in the intended order.
- If a header contains mixed declarations, helpers, macros, or multiple types,
use a snake_case filename.

## Scoped Instructions

Read the nearest module guide before editing files in that tree. These guides
keep public-header, test, example, documentation, and agent-workflow rules
close to the code they govern:

- [`include/logit_cpp/AGENTS.md`](include/logit_cpp/AGENTS.md) - public API and
header-only implementation contracts.
- [`tests/AGENTS.md`](tests/AGENTS.md) - test design, registration, and
platform-sensitive test rules.
- [`examples/AGENTS.md`](examples/AGENTS.md) - example portability and
dependency expectations.
- [`docs/AGENTS.md`](docs/AGENTS.md) - documentation consistency and generated
output boundaries.
- [`guides/AGENTS.md`](guides/AGENTS.md) - maintaining playbooks used by
humans and coding agents.

When a change crosses module boundaries, follow all applicable guides and
record the public contract in the narrowest relevant document. Do not copy
the same rule into every guide.

## Review Checklist

Before submitting a change, inspect both enabled and disabled compile-time
paths. In particular, check that `noexcept` functions cannot allocate, invoke
user callbacks, or propagate exceptions; that conditions are reachable and
not permanently true or false; that repeated logic has a single owner; and
that optional dependencies do not break a default build or package export.
Run the focused tests plus the relevant CMake configure/build flow and report
platform-only failures explicitly.

## Header Guards

For every project-owned C/C++ header, use `#pragma once` together with a
Expand Down
51 changes: 36 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,42 @@

All notable changes to this project will be documented in this file.

## [v1.0.2] - 2026-04-25
- Added raw and section logging macros for unformatted diagnostic snapshots that bypass level filters while still using configured backends, queues, routing, and file rotation.
- Added in-memory snapshot logging APIs, buffered entry retrieval, runtime logger snapshots, and examples for control-plane style diagnostics.
- Added persisted file access APIs for listing and reading current and rotated file logs.
- Added system logging backends for POSIX syslog and Windows Event Log, plus POSIX/Windows crash logger backends and registration macros.
- Added compile-time log-level filtering, runtime log-level controls, conditional logging helpers, frequency controls, tagging macros, stream/printf/scope macro coverage, and default no-op handling for disabled macro families.
- Added file logger size-based rotation, rotation naming policies, retention coverage, gzip/zstd/external-command compression support, and idempotent rotation tests.
- Added configurable async backpressure controls, queue policies, lock-free MPSC task execution, hot queue resizing, and TSAN-oriented regression coverage.
- Added Emscripten build support, CMake package installation metadata, pkg-config generation, vcpkg overlay updates, and install-consumer coverage.
- Added benchmark coverage and refreshed benchmark adapters, latency snapshots, and CI benchmark gating.
- Expanded CI coverage with sanitizer, Emscripten, ODR, install-consumer, compression, and platform-specific regression checks.
- Reorganized public include entry points, moved internal helpers under `detail`, hardened header-only ODR behavior, and fixed utility/header dependency issues.
- Refreshed README, README-RU, Doxygen, agent guidance, macro references, examples, and architecture/task-executor documentation.
- Updated bundled dependency pins, including TimeShield through `v1.0.5` and compression dependency pins.
- Fixed Windows crash-filter naming collisions, FileLogger rotation ordering and error handling, benchmark async flushing, MPSC/drop-policy accounting, fmt-disabled macro handling, and `LOGIT_SCOPE_*` duration logging with unnamed messages.
## [Unreleased]

Target release: **v1.0.2**

### Added

- Raw and section logging macros for unformatted diagnostic snapshots, plus in-memory and persisted snapshot/file access APIs.
- POSIX syslog, Windows Event Log, POSIX/Windows crash logger, Prometheus payload/registry/HTTP server, OTLP/HTTP, and MDBX logger backends.
- Structured OTLP attributes, callback-based exporting, payload splitting, compression, export counters, and MDC/NDC context support.
- Compile-time and runtime log-level controls, conditional/frequency/tagging helpers, stream/printf/fmt/scope macro families, and configurable console output.
- File rotation by size and timestamp with retention policies and gzip/zstd/external-command compression.
- Configurable asynchronous backpressure, queue policies, lock-free MPSC execution, hot queue resizing, and dedicated executor controls.
- Emscripten support, CMake/pkg-config package metadata, vcpkg integration, install-consumer coverage, and latency benchmarks.

### Changed

- Reorganized public umbrella headers and moved implementation helpers under `detail` while preserving header-only ODR safety.
- Made logger configuration, shutdown, queue resizing, and single-thread executor lifecycle behavior explicit and consistent across backends.

### Fixed

- Corrected file rotation ordering/error handling, async shutdown and flushing, queue drop accounting, MPSC lifecycle handling, and benchmark synchronization.
- Fixed platform portability issues, crash-filter naming collisions, disabled-fmt macro behavior, scope duration logging, and missing/self-contained header dependencies.

### Packaging / Build

- Refreshed bundled dependency revisions and canonical repository URLs.
- Added fail-closed installation checks for unsupported bundled optional dependencies and source-tree-only Prometheus server headers.

### CI / Testing

- Expanded regression coverage for sanitizers, TSAN, ODR, Emscripten, optional compression/backends, package consumers, and platform-specific behavior.

### Documentation

- Refreshed README, README-RU, Doxygen, examples, macro references, task-executor guidance, and scoped `AGENTS.md` instructions.

## [v1.0.1] - 2025-08-05
- Added initial CMake integration for building, installing, and consuming the header-only package.
Expand Down
66 changes: 62 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ if(LOGIT_WITH_OTLP)

if(NOT TARGET kurlyk AND LOGIT_USE_SUBMODULES)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/external/kurlyk/CMakeLists.txt")
if(CMAKE_VERSION VERSION_LESS 3.21)
message(FATAL_ERROR
"Bundled kurlyk requires CMake 3.21 or newer; install kurlyk separately "
"or upgrade CMake.")
endif()
set(KURLYK_WEBSOCKET_SUPPORT OFF CACHE BOOL "Disable kurlyk WebSocket support for LogIt++ OTLP" FORCE)
set(KURLYK_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)

Expand Down Expand Up @@ -230,6 +235,7 @@ if(LOGIT_WITH_GZIP)
find_package(ZLIB QUIET)
endif()
if(NOT TARGET ZLIB::ZLIB AND LOGIT_USE_SUBMODULES)
set(ZLIB_BUILD_EXAMPLES OFF CACHE BOOL "Disable bundled zlib examples" FORCE)
add_subdirectory(external/zlib EXCLUDE_FROM_ALL)
if(TARGET zlibstatic)
add_library(ZLIB::ZLIB ALIAS zlibstatic)
Expand Down Expand Up @@ -283,10 +289,6 @@ endif()

include(CMakePackageConfigHelpers)

install(DIRECTORY include/ DESTINATION include)

install(TARGETS log-it-cpp EXPORT log-it-cppTargets)

set(_logit_install_export_supported ON)

# install(EXPORT) requires all linked targets to be in an export set.
Expand Down Expand Up @@ -318,6 +320,62 @@ if(LOGIT_WITH_MDBX AND TARGET mdbx_containers::mdbx_containers)
endif()
endif()

if(LOGIT_WITH_FMT AND TARGET fmt::fmt)
get_target_property(_fmt_imported fmt::fmt IMPORTED)
if(NOT _fmt_imported)
set(_logit_install_export_supported OFF)
install(CODE [[
message(FATAL_ERROR
"log-it-cpp: Installing with bundled fmt is not supported. "
"Install fmt separately and use find_package(fmt), or disable LOGIT_WITH_FMT for install.")
]])
endif()
endif()

if(LOGIT_WITH_PROMETHEUS_SERVER)
set(_logit_install_export_supported OFF)
install(CODE [[
message(FATAL_ERROR
"log-it-cpp: Installing with LOGIT_WITH_PROMETHEUS_SERVER=ON is not currently supported. "
"Disable LOGIT_WITH_PROMETHEUS_SERVER for install.")
]])
endif()

# Bundled compression targets are implementation details of the build tree and
# are not part of this package's export set. Keep development builds working,
# but fail at install time with an actionable message, just like the other
# bundled optional dependencies above.
if(LOGIT_WITH_GZIP AND TARGET zlibstatic)
get_target_property(_zlib_imported zlibstatic IMPORTED)
if(NOT _zlib_imported)
set(_logit_install_export_supported OFF)
install(CODE [[
message(FATAL_ERROR
"log-it-cpp: Installing with bundled zlib is not supported. "
"Install zlib separately and use find_package(ZLIB), or disable LOGIT_WITH_GZIP for install.")
]])
endif()
endif()

if(LOGIT_WITH_ZSTD AND TARGET libzstd_static)
get_target_property(_zstd_imported libzstd_static IMPORTED)
if(NOT _zstd_imported)
set(_logit_install_export_supported OFF)
install(CODE [[
message(FATAL_ERROR
"log-it-cpp: Installing with bundled zstd is not supported. "
"Install zstd separately and use find_package(ZSTD), or disable LOGIT_WITH_ZSTD for install.")
]])
endif()
endif()

# Register the guard rules before any file or target install rule. If the
# selected dependency targets cannot be exported, `cmake --install` fails
# before writing a partial package tree.
install(DIRECTORY include/ DESTINATION include)

install(TARGETS log-it-cpp EXPORT log-it-cppTargets)

if(_logit_install_export_supported)
install(EXPORT log-it-cppTargets
FILE log-it-cppTargets.cmake
Expand Down
4 changes: 2 additions & 2 deletions README-RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ LogIt++ — это библиотека, работающая только с з
1. Клонируйте репозиторий с его подмодулями:

```bash
git clone --recurse-submodules https://github.com/NewYaroslav/log-it-cpp.git
git clone --recurse-submodules https://github.com/LimiNode/log-it-cpp.git
```
2. Включите заголовочные файлы LogIt++ в ваш проект:

Expand Down Expand Up @@ -885,4 +885,4 @@ LOGIT_ERROR("Что-то пошло не так");
---

## Лицензия
Эта библиотека распространяется под лицензией MIT. Подробности смотрите в файле [LICENSE](https://github.com/NewYaroslav/log-it-cpp/blob/main/LICENSE) в репозитории.
Эта библиотека распространяется под лицензией MIT. Подробности смотрите в файле [LICENSE](https://github.com/LimiNode/log-it-cpp/blob/main/LICENSE) в репозитории.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[![MIT License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS%20%7C%20Emscripten-blue)
![C++ Standard](https://img.shields.io/badge/C++-11--17-orange)
![CI Windows](https://img.shields.io/github/actions/workflow/status/NewYaroslav/log-it-cpp/ci.yml?branch=main&label=Windows&logo=windows)
![CI Linux](https://img.shields.io/github/actions/workflow/status/NewYaroslav/log-it-cpp/ci.yml?branch=main&label=Linux&logo=linux)
![CI macOS](https://img.shields.io/github/actions/workflow/status/NewYaroslav/log-it-cpp/ci.yml?branch=main&label=macOS&logo=apple)
![CI Windows](https://img.shields.io/github/actions/workflow/status/LimiNode/log-it-cpp/ci.yml?branch=main&label=Windows&logo=windows)
![CI Linux](https://img.shields.io/github/actions/workflow/status/LimiNode/log-it-cpp/ci.yml?branch=main&label=Linux&logo=linux)
![CI macOS](https://img.shields.io/github/actions/workflow/status/LimiNode/log-it-cpp/ci.yml?branch=main&label=macOS&logo=apple)

[Читать на русском](README-RU.md)

Expand Down Expand Up @@ -956,7 +956,7 @@ LogIt++ is a header-only library. To integrate it into your project, follow thes
1. Clone the repository with its submodules:

```bash
git clone --recurse-submodules https://github.com/NewYaroslav/log-it-cpp.git
git clone --recurse-submodules https://github.com/LimiNode/log-it-cpp.git
```
2. Include the LogIt++ headers in your project:

Expand Down Expand Up @@ -1093,4 +1093,4 @@ Detailed documentation for LogIt++, including API reference and usage examples,
---

## License
This library is licensed under the MIT License. See the [LICENSE](https://github.com/NewYaroslav/log-it-cpp/blob/main/LICENSE) file in the repository for more details.
This library is licensed under the MIT License. See the [LICENSE](https://github.com/LimiNode/log-it-cpp/blob/main/LICENSE) file in the repository for more details.
19 changes: 18 additions & 1 deletion cmake/log-it-cppConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,25 @@

include(CMakeFindDependencyMacro)
find_dependency(TimeShield)

if(@LOGIT_WITH_FMT@)
find_dependency(fmt CONFIG)
endif()

if(@LOGIT_WITH_OTLP@)
find_dependency(kurlyk CONFIG)
endif()

if(@LOGIT_WITH_GZIP@)
find_dependency(ZLIB)
endif()

if(@LOGIT_WITH_ZSTD@)
find_dependency(ZSTD)
endif()

if(@LOGIT_WITH_MDBX@)
find_dependency(mdbx_containers)
find_dependency(mdbx_containers CONFIG)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/log-it-cppTargets.cmake")
11 changes: 11 additions & 0 deletions docs/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Documentation Instructions

Documentation is part of the public API contract.

- Update the relevant English and Russian document together when behavior,
options, examples, or compatibility changes.
- Keep snippets buildable with the stated CMake options and include paths.
Prefer linking to one canonical explanation over duplicating long blocks.
- Distinguish implemented behavior from future plans and platform limitations;
do not promise optional backends that are not tested in the documented flow.
- Do not commit generated Doxygen output or local build artifacts.
6 changes: 5 additions & 1 deletion docs/OtlpHttpLogger.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

`OtlpHttpLogger` is an optional LogIt++ backend that exports log records to an OpenTelemetry-compatible OTLP/HTTP endpoint.

The backend is disabled by default and requires the optional [`kurlyk`](https://github.com/NewYaroslav/kurlyk) dependency.
The backend is disabled by default and requires the optional [`kurlyk`](https://github.com/LimiNode/kurlyk) dependency.

## CMake

Expand All @@ -16,6 +16,10 @@ When `kurlyk` is placed at `external/kurlyk`, LogIt++ adds it only when `LOGIT_W

For Windows MinGW builds, the CMake integration enables kurlyk fallback options for curl, OpenSSL, and Asio when `LOGIT_USE_SUBMODULES=ON`. This keeps OTLP optional while still allowing a ready-made MinGW dependency path through kurlyk.

The bundled kurlyk revision requires CMake 3.21 or newer. On other platforms,
install kurlyk (and its OpenSSL/curl prerequisites) separately and let
`find_package(kurlyk)` provide the target.

## Usage

For a runnable version with environment overrides, graceful shutdown, optional
Expand Down
6 changes: 3 additions & 3 deletions docs/mainpage.dox
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ First, clone the LogIt++ repository from GitHub along with its submodules. The r
To clone the repository with submodules, use the following command:

\code{bash}
git clone --recurse-submodules https://github.com/NewYaroslav/log-it-cpp.git
git clone --recurse-submodules https://github.com/LimiNode/log-it-cpp.git
\endcode

If you have already cloned the repository without submodules, you can initialize and update the submodules by running the following commands:
Expand Down Expand Up @@ -992,9 +992,9 @@ After adding the necessary include paths, you can proceed to build and run your
\section repo_sec Repository

The LogIt++ library is open-source and hosted on GitHub:
[LogIt++ GitHub Repository](https://github.com/NewYaroslav/log-it-cpp).
[LogIt++ GitHub Repository](https://github.com/LimiNode/log-it-cpp).

\section license_sec License

This library is licensed under the **MIT License**. See the [LICENSE](https://github.com/NewYaroslav/log-it-cpp/blob/main/LICENSE) file in the repository for more details.
This library is licensed under the **MIT License**. See the [LICENSE](https://github.com/LimiNode/log-it-cpp/blob/main/LICENSE) file in the repository for more details.
*/
13 changes: 13 additions & 0 deletions examples/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Example Instructions

Examples are compile-time and usage documentation for consumers.

- Include only installed/public headers and use the umbrella headers where
practical. Do not reach into `detail/` from an example.
- Keep examples portable across the default C++11 build. Guard MDBX, OTLP,
compression, and platform-specific code with the same CMake feature options
as the library.
- Examples must be safe to run repeatedly: use temporary output paths and do
not assume a writable system directory or external service.
- Keep output concise and explain prerequisites in the adjacent README when a
dependency or service is required.
2 changes: 1 addition & 1 deletion external/kurlyk
Submodule kurlyk updated 115 files
2 changes: 1 addition & 1 deletion external/mdbx-containers
Submodule mdbx-containers updated 296 files
Loading
Loading