Skip to content
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

Add centralized logging mechanism using Winston #16

Merged
merged 3 commits into from
Nov 24, 2024

Conversation

SunWuyuan
Copy link
Contributor

@SunWuyuan SunWuyuan commented Nov 23, 2024

Introduce a centralized logging mechanism using the Winston library for structured logging.

  • Add server/logger.js: Configure and export a Winston logger instance to log to both console and file with different logging levels (info, warn, error).
  • Modify app.js: Import the Winston logger and replace all console.log statements with logger.info and console.error statements with logger.error.
  • Modify server/configManager.js: Import the Winston logger and replace all console.error statements with logger.error.
  • Modify server/lib/global.js: Import the Winston logger and replace all console.log statements with logger.info and console.error statements with logger.error.
  • Modify server/router_project.js: Import the Winston logger and replace all console.log statements with logger.info and console.error statements with logger.error. Update error handling to use the new logging mechanism.

For more details, open the Copilot Workspace session.

Introduce a centralized logging mechanism using the Winston library for structured logging.

* **Add `server/logger.js`**: Configure and export a Winston logger instance to log to both console and file with different logging levels (info, warn, error).
* **Modify `app.js`**: Import the Winston logger and replace all `console.log` statements with `logger.info` and `console.error` statements with `logger.error`.
* **Modify `server/configManager.js`**: Import the Winston logger and replace all `console.error` statements with `logger.error`.
* **Modify `server/lib/global.js`**: Import the Winston logger and replace all `console.log` statements with `logger.info` and `console.error` statements with `logger.error`.
* **Modify `server/router_project.js`**: Import the Winston logger and replace all `console.log` statements with `logger.info` and `console.error` statements with `logger.error`. Update error handling to use the new logging mechanism.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/ZeroCatDev/zerocat-backend?shareId=XXXX-XXXX-XXXX-XXXX).
Copy link

vercel bot commented Nov 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
our-world ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 24, 2024 3:19am

@SunWuyuan SunWuyuan merged commit 69c8c9f into main Nov 24, 2024
4 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.

1 participant