Prototype logging macro API split#824
Draft
wgtmac wants to merge 1 commit into
Draft
Conversation
kamcheungting-db
added a commit
to kamcheungting-db/iceberg-cpp
that referenced
this pull request
Jul 16, 2026
Adopt the structure from the apache#824 prototype (keeping our if constexpr gating): - logger.h is now the C++ API only; ICEBERG_LOG_* macros move to log_macros.h, and the bare LOG_* aliases move behind an opt-in short_log_macros.h (replacing the ICEBERG_LOG_SHORT_MACROS define). - Dedup the five macro bodies onto shared internal helpers (EmitIfEnabled + LogToCurrent / LogToCurrentRuntime / LogToExplicitRuntime / LogFatal) that take a lazy [&]()->std::string message thunk invoked only past ShouldLog, so disabled logs still don't evaluate their args. Keeps catch(...), the GetCurrentLogger() fatal path, and if constexpr compile-time floor. - VFormat moves to log_macros.h (only ICEBERG_LOG_RUNTIME_FMT uses it). Co-authored-by: Isaac
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.
Summary
This is a prototype for the logging macro API shape discussed in #725.
It demonstrates a possible end state:
logger.hfocused on the C++ logging API;log_macros.h;LOG_*aliases behind an explicit opt-in header;This is meant as a design reference, not a replacement for #725.
Test Plan
.venv/bin/pre-commit run clang-format --files src/iceberg/logging/log_macros.h src/iceberg/logging/short_log_macros.h src/iceberg/logging/logger.h src/iceberg/test/log_macros_header_test.cc src/iceberg/test/log_macros_active_level_test.cc src/iceberg/test/log_macros_test.cc.venv/bin/pre-commit run cmake-format --files src/iceberg/CMakeLists.txt src/iceberg/test/CMakeLists.txt.venv/bin/pre-commit run meson-fmt --files meson.build src/iceberg/logging/meson.build src/iceberg/test/meson.buildninja -C builddir src/iceberg/test/logging_test./builddir/src/iceberg/test/logging_testcmake --build build --target logging_test./build/src/iceberg/test/logging_test