Skip to content

Logger Winnston implemented#99

Merged
amina69 merged 1 commit intoamina69:mainfrom
EzeanoroEbuka:main
Mar 31, 2026
Merged

Logger Winnston implemented#99
amina69 merged 1 commit intoamina69:mainfrom
EzeanoroEbuka:main

Conversation

@EzeanoroEbuka
Copy link
Copy Markdown
Contributor

@EzeanoroEbuka EzeanoroEbuka commented Mar 26, 2026

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).

Screenshot from 2026-03-26 19-24-48

@amina69 amina69 merged commit 5991717 into amina69:main Mar 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logger (Winston / Pino)

2 participants