Skip to content

feat(logging): add LogLevel severity enum (1/6)#722

Open
kamcheungting-db wants to merge 2 commits into
apache:mainfrom
kamcheungting-db:logging-block1-levels
Open

feat(logging): add LogLevel severity enum (1/6)#722
kamcheungting-db wants to merge 2 commits into
apache:mainfrom
kamcheungting-db:logging-block1-levels

Conversation

@kamcheungting-db

@kamcheungting-db kamcheungting-db commented Jun 10, 2026

Copy link
Copy Markdown

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.

  • enum class LogLevel { kTrace, kDebug, kInfo, kWarn, kError, kCritical, kFatal, kOff }, ordered most-to-least verbose so "should this log?" is a plain level >= threshold check. kOff is the max sentinel for disabling logging.
  • constexpr ToString(LogLevel) and a case-insensitive LogLevelFromString returning Result — same idiom as CounterUnit in metrics/counter.h.

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.

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.
@kamcheungting-db kamcheungting-db changed the title [Iceberg Logger] [Part-1] Add LogLevel Severity Enum feat: [Iceberg Logger] [Part-1] Add LogLevel Severity Enum Jun 10, 2026
@kamcheungting-db kamcheungting-db changed the title feat: [Iceberg Logger] [Part-1] Add LogLevel Severity Enum feat(logging): add LogLevel severity enum Jun 11, 2026
@kamcheungting-db kamcheungting-db changed the title feat(logging): add LogLevel severity enum feat(logging): add LogLevel severity enum (1/6) Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant