Make terminal logging colorful 馃寛 - #295
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces colorful terminal logging to enhance visibility of warn/error logs, while also adding an option to disable color output via a flag.
- Added integration with slogcolor and fatih/color libraries to render colorful logs.
- Introduced a new flag (--no-color-logs) in the command line and corresponding config options.
- Modified logging handler implementations to choose between standard and colorized output.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/pkg/log/fielded_logger.go | Updated log method to replicate slog.Logger behavior with colors. |
| internal/pkg/log/config.go | Added new color-specific handler and configuration options. |
| internal/pkg/config/config.go | Introduced configuration for disabling color logging. |
| go.mod | Added required dependencies for color logging. |
| cmd/cmd.go | Added CLI flag for turning off colorized logging. |
also added --no-color-logs flag to disable this
yzqzss
force-pushed
the
colorful-logging-life
branch
from
May 23, 2025 17:22
fca7542 to
889b78c
Compare
NGTmeaty
approved these changes
May 23, 2025
NGTmeaty
left a comment
Collaborator
There was a problem hiding this comment.
It's so much easier to read. Thank you! LGTM!
This was referenced May 31, 2025
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.
Now my eyes can easily spot the warn/error logs from the terminal stream.
Also added --no-color-logs flag to disable this feature. (to switch back to [slog] handler)
This PR only colors the stdout and stderr terminal logging handlers and does not affect the file logging handler (
/jobs/{job}/log/ZENO-{time}.log).The [slogcolor] handler's output format is slightly different from slog. For example, it does not escape the
"to\"in the log message.Introduced lib: