refactor!: remove unused deprecated context API methods#536
Conversation
BREAKING CHANGE: Remove deprecated methods that had no external consumers: - clear_context(), has_context(), get_context() - set_context_id(), get_context_id(), clear_context_id(), has_context_id(), clear_all_context_ids() Migrate internal callers (log_context_scope, tests, examples) to the unified context() API. Preserved deprecated methods still used by file_trans_system: - set_context() (4 overloads), remove_context() - set_otel_context(), get_otel_context(), clear_otel_context(), has_otel_context() Note: result<T> (lowercase, logger-specific wrapper) vs Result<T> (common alias) inconsistency is intentional but worth unifying later. Refs: #534
Add breaking change entry for deprecated context method removal.
Performance Regression Check
Threshold: >5% regression triggers warning |
CI/CD Failure AnalysisAnalysis Time: 2026-03-20 17:10 KST Failed Workflows
Root Cause AnalysisPrimary Error: Analysis: All 7 CI failures stem from this single compilation error — Integration Tests, Coverage, Performance, and FetchContent all fail because the test binary cannot be built. Identified Issues:
Proposed Fix
Next Steps
Automated failure analysis - Attempt #1 |
Replace has_context(), get_context(), clear_context(), and remove_context() calls in tests and examples with the new unified context() API methods. Fixes CI build failure caused by removed deprecated methods.
CI/CD Failure AnalysisAnalysis Time: 2026-03-20 09:15 UTC Failed Workflows
Root Cause AnalysisPrimary Error: Analysis: Why other CI jobs pass: Workflows like Integration Tests and Core-Only Build use an explicit Identified Issues:
Proposed Fix
Next Steps
Automated failure analysis - Attempt #1 |
Short commit hash (93b1d0f) fails to resolve during FetchContent shallow clone operations. Replace with the full 40-character hash to ensure reliable dependency resolution across all CI workflows.
FetchContent GIT_SHALLOW only works with tags and branch names. When GIT_TAG is a commit hash (hex-only string), shallow clone fails because git --depth=1 only fetches the branch tip. Detect hash-style tags and disable shallow clone for them.
CMake macro parameters are text replacements, not variables.
In if(GIT_TAG MATCHES ...), CMake treats 'GIT_TAG' as a literal
string, not the macro argument value. Use "${GIT_TAG}" to force
parameter expansion before the if() evaluation.
CI/CD Failure Analysis - Attempt #3Previous Attempt Result: Failed (same error persisted)
What ChangedPrevious Fix:
Why It Still Failed:
New Root CauseError: Analysis: Fix Applied
Automated failure analysis - Attempt #3 of 3 |
* refactor\!: remove unused deprecated context API methods BREAKING CHANGE: Remove deprecated methods that had no external consumers: - clear_context(), has_context(), get_context() - set_context_id(), get_context_id(), clear_context_id(), has_context_id(), clear_all_context_ids() Migrate internal callers (log_context_scope, tests, examples) to the unified context() API. Preserved deprecated methods still used by file_trans_system: - set_context() (4 overloads), remove_context() - set_otel_context(), get_otel_context(), clear_otel_context(), has_otel_context() Note: result<T> (lowercase, logger-specific wrapper) vs Result<T> (common alias) inconsistency is intentional but worth unifying later. Refs: #534 * docs: add Phase 2 changelog entry for #534 Add breaking change entry for deprecated context method removal. * fix(test): migrate remaining has_context() calls to unified context API Replace has_context(), get_context(), clear_context(), and remove_context() calls in tests and examples with the new unified context() API methods. Fixes CI build failure caused by removed deprecated methods. * fix(cmake): use full commit hash for common_system FetchContent Short commit hash (93b1d0f) fails to resolve during FetchContent shallow clone operations. Replace with the full 40-character hash to ensure reliable dependency resolution across all CI workflows. * fix(cmake): disable shallow clone for commit hash references FetchContent GIT_SHALLOW only works with tags and branch names. When GIT_TAG is a commit hash (hex-only string), shallow clone fails because git --depth=1 only fetches the branch tip. Detect hash-style tags and disable shallow clone for them. * fix(cmake): use quoted expansion for macro parameter in if() CMake macro parameters are text replacements, not variables. In if(GIT_TAG MATCHES ...), CMake treats 'GIT_TAG' as a literal string, not the macro argument value. Use "${GIT_TAG}" to force parameter expansion before the if() evaluation.
What
Removes 8 deprecated methods from the logger API that have been superseded by the unified
context()API. Migrates internal callers and tests to the new API.Why
Fixes #534 -- These methods were deprecated in favor of the unified
context()API (introduced in 3.4.0). All 8 removed methods had zero external callers (verified via grep across the ecosystem). Keeping them increases maintenance burden and API surface confusion.Removed Methods
clear_context()context().clear()has_context()!context().empty()get_context()context().to_fields()set_context_id(key, value)context().set(key, value, context_category::trace)get_context_id(key)context().get_string(key)clear_context_id(key)context().remove(key)has_context_id(key)context().has(key)clear_all_context_ids()context().clear(context_category::trace)How
logger.h: Removed 8 method declarations (~107 lines)logger.cpp: Removed implementations (~63 lines), added removal commentlog_context_scope.cpp: Migrated fromset_context()/remove_context()tocontext().set()/context().remove()structured_logging_test.cpp: Migrated all test cases to unified context APIstructured_logging_example.cpp: Updated examples to use new APIBreaking Changes
This is a breaking change for any code calling the 8 removed methods. Note:
set_context()andremove_context()are still preserved as they have active callers.