feat: implement logging throughout the linebot application#5
Merged
Conversation
This commit introduces a centralized logging system. A new module `linebot/app/config/logger.py` is created to configure and provide logger instances. The logging configuration includes: - Log formatting with timestamp, logger name, level, and message. - Console output with configurable log level. - File output with rotating file handler (max 10MB, 5 backups). - A global `app_logger` instance for general application logging. The existing `print` statements in `linebot/app/api/vision.py` and `linebot/app/routers/linebot.py` are replaced with calls to the new logging system. This allows for better control and management of application logs. Additionally, the `.gitignore` file is updated to ignore the `logs/` directory, preventing log files from being committed to the repository.
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a centralized logging system to replace print statements and standard logger calls with a uniform, configurable logging setup across the application.
- Introduces a new logger module that configures both console and rotating file handlers
- Replaces print statements with logger calls in message handling, API, and router modules
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| linebot/app/webhooks/handlers.py | Replaced print statements with logger.info calls |
| linebot/app/services/message_service.py | Updated logging initialization to use get_logger |
| linebot/app/services/handlers/text_handler.py | Switched to centralized logger for text message handling |
| linebot/app/services/handlers/image_handler.py | Replaced standard logging with get_logger usage |
| linebot/app/services/handlers/common.py | Updated logger initialization with get_logger |
| linebot/app/services/handlers/audio_handler.py | Replaced print statement with logger.info call |
| linebot/app/routers/linebot.py | Replaced print calls with logger calls for various events |
| linebot/app/config/logger.py | Introduced centralized logging configuration |
| linebot/app/api/vision.py | Replaced print with logger.error for error handling |
MH-limarco
added a commit
that referenced
this pull request
May 31, 2025
# This is the 1st commit message: auto_update activity_KB # This is the commit message #2: auto_update activity_KB # This is the commit message #3: auto_update activity_KB debug debug debug debug debug debug debug debug debug debug debug debug debug debug debug done debug done debug done tidy up tidy up tidy up tidy up tidy up # This is the commit message #4: tidy up # This is the commit message #5: auto_update activity_KB debug debug debug debug debug debug debug debug debug debug debug debug debug debug debug done debug done debug done tidy up tidy up tidy up tidy up tidy up
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 commit introduces a centralized logging system. A new module
linebot/app/config/logger.pyis created to configure and provide logger instances. The logging configuration includes:app_loggerinstance for general application logging.The existing
printstatements inlinebot/app/api/vision.pyandlinebot/app/routers/linebot.pyare replaced with calls to the new logging system. This allows for better control and management of application logs.Additionally, the
.gitignorefile is updated to ignore thelogs/directory, preventing log files from being committed to the repository.