π 25 Jul 2025
View on Github βconsole.log
scattered throughout DevFlowinfo
, warn
, error
)logger.info('User logged in', { userId, time: new Date().toISOString() });
* Saved logs into a `logs` collection in MongoDB
* Console still prints logs, but DB keeps full history
### π― Log Types Tracked
* β
Auth events (login, logout)
* β
User actions (e.g., post answer, delete comment)
* β
Errors with stack traces
## β Blockers
* Initially struggled with Mongo connection for logging without circular imports
* Had to debounce log writes in some areas to avoid spam
## π§ Reflection
Logging isnβt boring β itβs **your eyes into production**.
Now I can trace user behavior, debug faster, and track performance over time.
βGood logs donβt just tell you what happened β they tell you *why* it happened.β
## π References / Code
* π§ [DevFlow Logging Commit](https://github.com/Sangam5756/devflow/commit/72a37c73716914f914a4af852a3e127f345e2905)
* π» [DevFlow Repository](https://github.com/Sangam5756/devflow)