-
Notifications
You must be signed in to change notification settings - Fork 559
support setting log level for backend #1958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe logging initialization logic in both the backend and CLI components was updated to support dynamic log level configuration through the Changes
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Enhanced logging configuration across Digger by adding WARN level support alongside existing DEBUG and INFO levels, implemented consistently in both CLI and backend components using Go's slog package.
- Added WARN log level support in
cli/cmd/digger/default.go
viaDIGGER_LOG_LEVEL
environment variable - Standardized log level configuration in
backend/bootstrap/main.go
to match CLI implementation - Both components now use consistent
slog.NewTextHandler
setup with level-based filtering
2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
backend/bootstrap/main.go (1)
249-268
: LGTM! Comprehensive log level support implemented.The implementation correctly supports all major log levels (DEBUG, WARN, ERROR) with a sensible default to INFO. The past review comment about adding ERROR level support has been addressed.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
backend/bootstrap/main.go
(1 hunks)cli/cmd/digger/default.go
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Build
- GitHub Check: Build
- GitHub Check: Build
} else if logLevel == "WARN" { | ||
level = slog.LevelWarn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add ERROR level support for consistency with backend.
The WARN level support looks good, but there's an inconsistency: the backend supports ERROR level while the CLI doesn't. For consistent behavior across components, consider adding ERROR level support.
if logLevel == "DEBUG" {
level = slog.LevelDebug
} else if logLevel == "WARN" {
level = slog.LevelWarn
+ } else if logLevel == "ERROR" {
+ level = slog.LevelError
} else {
level = slog.LevelInfo
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
} else if logLevel == "WARN" { | |
level = slog.LevelWarn | |
if logLevel == "DEBUG" { | |
level = slog.LevelDebug | |
} else if logLevel == "WARN" { | |
level = slog.LevelWarn | |
} else if logLevel == "ERROR" { | |
level = slog.LevelError | |
} else { | |
level = slog.LevelInfo | |
} |
🤖 Prompt for AI Agents
In cli/cmd/digger/default.go around lines 27 to 28, the code handles the WARN
log level but lacks support for the ERROR log level, causing inconsistency with
the backend. Add a condition to check if logLevel equals "ERROR" and set level
to slog.LevelError accordingly to ensure consistent log level handling across
components.
continuation for #1923
Summary by CodeRabbit