Skip to content

serve slog - #180

Merged
abergasov merged 2 commits into
mainfrom
_serve_slog
Aug 11, 2026
Merged

serve slog#180
abergasov merged 2 commits into
mainfrom
_serve_slog

Conversation

@abergasov

@abergasov abergasov commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added access to the underlying structured logger for supported application logging integrations.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The AppLogger interface now exposes Slog() *slog.Logger. SLogger implements the method and returns its wrapped native logger.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: hpsing, swarna1101

🚥 Pre-merge checks | ✅ 7 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title relates to the Slog change but does not follow the required type(domain/pkg): imperative summary format. Rename the title to a valid form, such as "feat(logger): expose native slog logger".
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Scope Discipline ✅ Passed The PR changes only pkg/logger/logger.go, adding AppLogger.Slog and its SLogger implementation; no unrelated files, refactors, or dependency changes are present.
Behavior Safety ✅ Passed The sole change adds Slog() and returns SLogger.logger directly; existing logger paths remain unchanged, and the accessor is trivial.
Over-Engineering ✅ Passed The PR adds only the requested AppLogger method and a direct SLogger accessor; it adds no cache, helper layer, or implementation-detail tests.
Security ✅ Passed The PR diff adds only AppLogger/SLogger Slog access; it adds no credentials, crypto, input handling, or secret logging, and returns the existing JSON-backed logger.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch _serve_slog

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/logger/logger.go`:
- Line 133: Remove the redundant “Slog return native slogger” comment near the
logger method; leave the method implementation unchanged unless it has a
required protocol contract needing documentation.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: getoptimum/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9bc36521-cdae-4d96-a644-b9a2b0b8682f

📥 Commits

Reviewing files that changed from the base of the PR and between 0502eed and 32d5d34.

📒 Files selected for processing (1)
  • pkg/logger/logger.go

Comment thread pkg/logger/logger.go Outdated
return &SLogger{logger: l.logger.With(prepareSlogParams(nil, fields)...)}
}

// Slog return native slogger

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the restating comment.

The comment does not document non-obvious behavior. Remove it unless this method has a protocol contract that requires explanation. As per path instructions, comments are only for non-obvious business logic or protocol details.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/logger/logger.go` at line 133, Remove the redundant “Slog return native
slogger” comment near the logger method; leave the method implementation
unchanged unless it has a required protocol contract needing documentation.

Source: Path instructions

Copilot AI 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.

Pull request overview

This PR exposes the underlying *slog.Logger from the repository’s AppLogger abstraction to support integrations that need direct access to Go’s structured logger.

Changes:

  • Added Slog() *slog.Logger to the AppLogger interface.
  • Implemented Slog() on *SLogger to return the wrapped *slog.Logger.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/logger/logger.go
Comment thread pkg/logger/logger.go Outdated
Comment thread pkg/logger/logger.go
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@abergasov
abergasov merged commit 8910679 into main Aug 11, 2026
6 of 7 checks passed
@abergasov
abergasov deleted the _serve_slog branch August 11, 2026 11:06

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/logger/logger.go (1)

43-43: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Treat this interface addition as a breaking API change.

AppLogger is exported. Adding Slog() breaks external implementations and test doubles that do not define this method. Unclear from diff whether this release permits a source-breaking change. If compatibility is required, expose Slog() through a separate optional interface; otherwise document the breaking change and check downstream implementations before merge.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/logger/logger.go` at line 43, Evaluate the exported AppLogger interface
change adding Slog() as a breaking API update. If backward compatibility is
required, remove Slog() from AppLogger and expose it through a separate optional
interface; otherwise document the intentional breaking change and verify
downstream implementations and test doubles are updated.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@pkg/logger/logger.go`:
- Line 43: Evaluate the exported AppLogger interface change adding Slog() as a
breaking API update. If backward compatibility is required, remove Slog() from
AppLogger and expose it through a separate optional interface; otherwise
document the intentional breaking change and verify downstream implementations
and test doubles are updated.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: getoptimum/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 105855ac-a6ca-4b47-a8f5-4ac1272f553b

📥 Commits

Reviewing files that changed from the base of the PR and between 32d5d34 and c96e33e.

📒 Files selected for processing (1)
  • pkg/logger/logger.go

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.

3 participants