Skip to content

feat: Logging Hook - #139

Open
NeaguGeorgiana23 wants to merge 32 commits into
mainfrom
logging_hook
Open

NeaguGeorgiana23 wants to merge 32 commits into
mainfrom
logging_hook

Conversation

@NeaguGeorgiana23

@NeaguGeorgiana23 NeaguGeorgiana23 commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

This PR

  • Logging Hook Support:
    • Implements LoggingHook as mentioned in the OpenFeature specification.
    • Introduces LogLevel and LogCallback for pluggable loggers with standard stream defaults.
    • Supports all 4 hook stages (Before, After, Error, Finally) with optional evaluation context logging.
  • Exception Hierarchy:
    • Adds structured OpenFeatureException hierarchy with associated ErrorCode values.
  • Serialization:
    • Adds string conversions (ToString()) and streaming operators for EvaluationContext, Reason, ErrorCode, and Value.

Related Issues

Fixes #138

@NeaguGeorgiana23
NeaguGeorgiana23 requested review from a team as code owners September 1, 2026 21:13
@coderabbitai

coderabbitai Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a423e475-4dd8-4c47-92eb-391dee1a9532
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@NeaguGeorgiana23
NeaguGeorgiana23 changed the base branch from main to hook_execution_lifecycle September 15, 2026 13:37
@NeaguGeorgiana23
NeaguGeorgiana23 added this pull request to stack #142 September 15, 2026 13:38
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>

@m-olko m-olko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't finished the review, but I think I left enough comments. Please let me know when you fix them, I will continue with the review

Comment thread openfeature/value.cpp Outdated
Comment thread openfeature/evaluation_context.cpp Outdated
Comment thread openfeature/evaluation_context.cpp Outdated
Comment thread openfeature/hooks/log_level.h Outdated
Comment thread openfeature/hooks/logging_hook.cpp
Comment thread openfeature/value.cpp Outdated
Comment thread openfeature/value.cpp Outdated
Comment thread openfeature/value.cpp Outdated
Comment thread openfeature/value.cpp Outdated
Comment thread openfeature/value.cpp
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
@NeaguGeorgiana23
NeaguGeorgiana23 removed this pull request from stack #142 September 21, 2026 08:26
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Base automatically changed from chore/linter-and-build-fixes to main September 22, 2026 17:59
NeaguGeorgiana23 added a commit that referenced this pull request Sep 22, 2026
## This PR
Moves all linter fixes from PR #139 here.

---------

Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Comment thread openfeature/value.cpp
Comment thread openfeature/exceptions/open_feature_exceptions.h Outdated
Comment thread openfeature/value.cpp
Comment thread openfeature/value.cpp Outdated
Comment thread openfeature/value.cpp Outdated
Comment thread openfeature/value.cpp Outdated
Comment thread openfeature/hooks/logging_hook.cpp
Comment thread openfeature/hooks/logging_hook.cpp Outdated
Comment thread openfeature/hooks/logging_hook.h Outdated
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Comment thread openfeature/hooks/log_level.h Outdated
Comment on lines +12 to +24
class OpenFeatureException : public std::runtime_error {
public:
explicit OpenFeatureException(ErrorCode error_code,
const std::string& message = "")
: std::runtime_error(message.empty() ? std::string(ToString(error_code))
: message),
error_code_(error_code) {}

ErrorCode GetErrorCode() const noexcept { return error_code_; }

private:
ErrorCode error_code_{ErrorCode::kGeneral};
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally find creating an exception just for sake of grouping error-related information together confusing. Given we don't throw exceptions in the SDK, but we use absl::Status instead, I'd opt for creating struct of (absl:Status, error_message) instead.

Comment thread test/evaluation_context_test.cpp Outdated
Comment thread test/evaluation_context_test.cpp Outdated
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
@NeaguGeorgiana23
NeaguGeorgiana23 requested a review from oxddr October 5, 2026 19:09
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.

Implement Logging Hook

3 participants