Colored Logging & Improved Backend Logs #255
Merged
its-me-abhishek merged 1 commit intoCCExtractor:mainfrom Dec 9, 2025
Merged
Conversation
…acelet/log, integrated via log.NewWithOptions(os.Stderr, log.Options{}), automatically provides colored output based on log levels if the terminal supports ANSI.
|
Thank you for opening this PR! Before a maintainer takes a look, it would be really helpful if you could walk through your changes using GitHub's review tools. Please take a moment to:
This helps make the review process smoother and gives us a clearer understanding of your thought process. Once you've added your self-review, we'll continue from our side. Thank you! |
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.
…This PR addresses the current backend logging system, which was unstructured and difficult to read, hindering efficient debugging and monitoring. The solution integrates
github.com/charmbracelet/logto implement structured, leveled, and colored logging.4
5 Key changes include:
6 - Addition of
github.com/charmbracelet/logas a dependency.7 - Creation of
backend/utils/logger.goto centralize logger configuration, allowing for environment variable-driven log levels and automatic colored output.8 - Replacement of native
logandfmtcalls withutils.Loggerthroughout core backend files (main.go,controllers/job_queue.go,controllers/app_handlers.go,controllers/websocket.go).9 - Modification of
models/logs.goto ensure that in-memory logs for the frontend are also mirrored to the structured console logger for comprehensive visibility.10
11 This significantly improves log readability, accelerates debugging, and provides a cleaner, more professional log output for development and production environments, with colors
differentiating log levels (e.g., Green for Info, Yellow for Warn, Red for Error).
12
13 - Fixes: #144
14
15 ### Checklist
16
17 - [ ] Ran
npx prettier --write .(for formatting)18 - [ ] Ran
gofmt -w .(for Go backend)19 - [ ] Ran
npm test(for JS/TS testing)20 - [ ] Added unit tests, if applicable
21 - [ ] Verified all tests pass
22 - [ ] Updated documentation, if needed
23
24 ### Additional Notes
25
26 The
charmbracelet/loglibrary automatically applies colored output when logging to a terminal that supports ANSI escape codes. This functionality is enabled by default with the currenintegration.