Merged
Conversation
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.
PR: Logger (Winston / Pino)
Closes #40
Overview
This PR implements structured logging across the application to improve observability and simplify log parsing in production environments. By moving away from the default NestJS logger, we now ensure that all logs are emitted as JSON objects with consistent metadata.
💡 Key Changes
Core Integration: Replaced the default NestJS logger with [Winston/Pino] in main.ts.
Structured Output: Configured logs to output in JSON format, including timestamp, level, and context.
Environment Awareness: * Development: Pretty-printed logs for human readability.
Production: Minified JSON for efficient ingestion by log management tools (e.g., Datadog, ELK, or CloudWatch).
Global Interceptor/Middleware: (Optional: mention if you added a request logger) Added logging for incoming HTTP requests to track latency and status codes.
🛠️ Technical Details
Library: [Insert Winston or Pino here]
Log Levels: Implemented error, warn, info, and debug.
Global Logger: The logger is provided as a global service/module, allowing for dependency injection in any controller or service.
How to Test
Start the app: npm run start:dev.
Trigger logs: Navigate to any API endpoint (e.g., GET /pets).
Verify Format:
Check that logs appear in the console.
Change NODE_ENV to production and verify the output switches to structured JSON.
Check Levels: Ensure that throwing an error properly triggers an error level log with a stack trace.
Closes - #40 Logger (Winson/pino)
Please review the implementation and test the endpoints via Swagger UI (
/api/docs).