Add comprehensive logging across application#53
Merged
sdglitched merged 1 commit intomainfrom Aug 12, 2025
Merged
Conversation
Reviewer's GuideThis PR integrates a centralized logging framework across the FastAPI application by importing a new logging_setup module and adding structured log statements (general, warning, success, failure) at key points in routers, authentication utilities, CLI commands, and database setup. It also introduces the logging_setup helper, adjusts customer schema fields to be optional, and bumps the Python requirement to 3.13. Sequence diagram for logging in product creationsequenceDiagram
participant Business as actor Business User
participant API as Product API
participant DB as Database
participant Log as logging_setup
Business->>API: POST /product (add product)
API->>Log: general("Adding product ...")
API->>DB: Add product
alt DB error
API->>Log: failure("Product creation failed ...")
API->>Business: HTTP 500
else Success
API->>Log: success("Product ... created successfully ...")
API->>Business: Product created response
end
Sequence diagram for logging in customer authentication (basic auth)sequenceDiagram
participant Customer as actor Customer
participant API as Customer API
participant DB as Database
participant Log as logging_setup
Customer->>API: Basic Auth login
API->>DB: Query customer by email
alt No customer found
API->>Log: warning("No customer account found ...")
API->>Customer: Authentication failed
else Invalid password
API->>Log: warning("Invalid password for customer ...")
API->>Customer: Authentication failed
else Success
API->>Log: success("Customer authenticated via basic auth ...")
API->>Customer: Authentication success
end
Sequence diagram for logging in OAuth authenticationsequenceDiagram
participant User as actor User
participant API as OAuth API
participant Log as logging_setup
User->>API: OAuth login
API->>Log: warning("Invalid OAuth token ...")
API->>Log: success("OAuth token validated successfully ...")
API->>Log: warning("OAuth token validation failed")
API->>User: Auth result
Class diagram for the new logging_setup moduleclassDiagram
class logging_setup {
+success(message)
+failure(message)
+warning(message)
+general(message)
SUCCESS : str
FAILURE : str
WARNING : str
GENERAL : str
STDS : str
}
Class diagram for updated CustomerView schemaclassDiagram
class CustomerView {
email: EmailStr
name: str
addr_line_1: Optional[str]
addr_line_2: Optional[str]
city: Optional[str]
state: Optional[str]
}
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @sdglitched - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
- Implement structured logging throughout the application to improve monitoring, debugging, and operational visibility. Signed-off-by: Shounak Dey <shounakdey@ymail.com>
e46c76a to
6783cfd
Compare
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.
Add comprehensive logging across application to improve monitoring, debugging, and operational visibility.
Fixes: #52
Summary by Sourcery
Add a centralized logging setup and integrate comprehensive info, success, warning, and error logs across routers, auth utilities, database setup, and CLI commands to improve monitoring, debugging, and operational visibility
New Features:
Enhancements:
Build: