feat(logging): add LogLevel severity enum (1/6)#722
Open
kamcheungting-db wants to merge 2 commits into
Open
Conversation
Re-add spdlog as a build dependency to serve as the foundation for the logging system. Adapted to current structure: spdlog joins the core iceberg lib interface lists (roaring has since moved to iceberg_data). Co-authored-by: Isaac
This is the first of six small PRs that together add a logging system to iceberg-cpp. It introduces LogLevel, the severity scale everything else builds on: trace, debug, info, warn, error, critical, fatal, plus an `off` sentinel for turning logging off entirely. Levels are ordered from most to least verbose, so deciding whether something should be logged is a plain `level >= threshold` comparison. Two helpers come with it: ToString to print a level, and LogLevelFromString to parse one (case-insensitive, returning a Result for unrecognized input). Both follow the same shape as CounterUnit in metrics/counter.h. There is no implementation behind the header yet, so this PR only adds the header, wires the new src/iceberg/logging directory into the build, and adds a test covering the round-trip, ordering, and parsing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
First of PR that adds a logging system to iceberg-cpp.
This PR adds LogLevel — the severity scale every later piece builds on — and nothing else.
Header-only: this PR adds src/iceberg/logging/log_level.h, wires the new src/iceberg/logging/ directory into CMake, and adds log_level_test.cc (ToString/FromString round-trip, case-insensitivity, unknown-input error, ordering).
Why
iceberg-cpp has no logging today — only error-as-value Result. This stack introduces a pluggable logger; levels are the foundational vocabulary, landed on their own so the
rest reviews cleanly.
Testing
compiled and run with clang++ -std=c++23 -stdlib=libc++ (clang 18).
The logging module builds clean and a behavior driver passes (levels round-trip, macro formatting + source location, gate filtering, disabled-arg elision, never-throws fallback, FATAL emit-then-abort, compile-time stripping).
Full ctest -R logging_test + the spdlog-ON build still want a C++23 toolchain with network (gtest/spdlog via FetchContent) in CI.