-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add serilog logging #31
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe Dotnet Foundation's API project has embraced enhanced logging capabilities by integrating Serilog, a popular .NET logging library. This upgrade includes the addition of several Serilog packages to enrich logging functionality, alongside the configuration of both file and console logging with a custom template. This ensures a robust logging mechanism, further augmented by request logging middleware for comprehensive monitoring. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to path filters (1)
DotnetFoundation/DotnetFoundation.Api/appsettings.Development.json
is excluded by:!**/*.json
Files selected for processing (2)
- DotnetFoundation/DotnetFoundation.Api/DotnetFoundation.Api.csproj (1 hunks)
- DotnetFoundation/DotnetFoundation.Api/Program.cs (3 hunks)
Additional comments: 5
DotnetFoundation/DotnetFoundation.Api/DotnetFoundation.Api.csproj (3)
- 11-11: The addition of the
Serilog.AspNetCore
package reference is correct and necessary for integrating Serilog with ASP.NET Core.- 12-12: The addition of the
Serilog.Expressions
package reference is correct and supports advanced log event filtering and transformation.- 13-13: The addition of the
Serilog.Formatting.Compact
package reference is correct and enables compact JSON formatting for logs, aligning with the structured logging approach.DotnetFoundation/DotnetFoundation.Api/Program.cs (2)
- 57-70: The Serilog setup and configuration for both file and console logging are correctly implemented, following best practices for structured logging. However, consider making the log file path configurable through
appsettings.json
or environment variables to enhance flexibility in different environments.- 94-94: The integration of Serilog with request logging middleware using
UseSerilogRequestLogging
is correctly implemented and placed within the request pipeline configuration.
Description
Add console and file logging using serilog
Log file is present in
./DotnetFoundation.Api/Logs/log-{timestamp}.ndjson
Followed recommended format
Reference for expressionTemplate: https://nblumhardt.com/2021/06/customize-serilog-json-output/#:~:text=Tip%3A%20output,.Code
Osmosys coding standards: https://github.com/OsmosysSoftware/dev-standards/blob/main/coding-standards/log-format.md
Log output using serilog expressionTemplate
Screenshots
logfile
console
Summary by CodeRabbit