Add rlog package with custom logging levels and features#38
Merged
chris-okuda merged 19 commits intomainfrom Mar 24, 2026
Merged
Add rlog package with custom logging levels and features#38chris-okuda merged 19 commits intomainfrom
rlog package with custom logging levels and features#38chris-okuda merged 19 commits intomainfrom
Conversation
- Introduced the rlog package, which wraps the standard library's slog package. - Added custom severity levels: TRACE, FATAL, and PANIC. - Implemented MergeWithCustomLevels function to customize logging behavior. - Created Logger type with methods for TRACE, FATAL, and PANIC logging. - Added tests to validate logging functionality and custom levels in JSON output. - Updated README to include rlog package information.
…o only uses the stdlib.
assert package changes:
- Modernized assertion functions to accept 'any' instead of 'interface{}'
- Introduced new Contains and NotContains functions for string containment assertions.
- Introduced new PanicsWithValue function for panic assertions.
- Introduced DebugAttrs, InfoAttrs, WarnAttrs, and ErrorAttrs methods to the Logger for logging at respective slog levels with context and attributes. - Added unit tests for each new logging method to verify correct output and level in logs. - Updated existing tests to assert log levels for various logging scenarios.
Signed-off-by: Chris Okuda <chris@rotational.io>
chris-okuda
commented
Mar 22, 2026
Contributor
Author
chris-okuda
left a comment
There was a problem hiding this comment.
Comments for reviewer
bbengfort
approved these changes
Mar 23, 2026
Contributor
bbengfort
left a comment
There was a problem hiding this comment.
Awesome work! Excited to use this for logging.
Can you create a story or stories for some follow up functionality:
- Ability to set a global logger and a global level with our custom handler.
- Shortcut functions at the package level for Info, InfoContext, etc. that use the global logger which should be the default logger if not set.
- Level decoder functionality as mentioned in a previous comment.
The above will make it much easier to replace zerolog in our codebase!
Co-authored-by: Benjamin Bengfort <benjamin@rotational.io> Signed-off-by: Chris Okuda <chris@okuda.dev>
…tions plus testing to ensure a concurrency safe implementation
Contributor
Author
I did these in here because they will be too useful to skip now. |
…o the user for now
…put of each log func call
bbengfort
approved these changes
Mar 24, 2026
Contributor
bbengfort
left a comment
There was a problem hiding this comment.
Thanks for adding that functionality!
https://go.dev/doc/effective_go#init Co-authored-by: Benjamin Bengfort <benjamin@rotational.io> Signed-off-by: Chris Okuda <chris@okuda.dev>
Signed-off-by: Chris Okuda <chris@rotational.io>
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.
Scope of changes
The 'r' stands for "Rotational" 😃
rlogpackage, which wraps the standard library'slog/slogpackage.Loggertype with methods for Trace*, Fatal*, and Panic* logging functions.slog.LogAttrs, including the default log levels.Contains,NotContains, andPanicsWithValuethat perform the same functions as therequirepackage functions of the same names to theassertpackage for easier testing.See comments for reviewer: #38 (review)
Fixes SC-37723
Type of change
Author checklist
Reviewer(s) checklist