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

Improved Logging #86

Closed
michaelbromley opened this issue Apr 9, 2019 · 1 comment
Closed

Improved Logging #86

michaelbromley opened this issue Apr 9, 2019 · 1 comment

Comments

@michaelbromley
Copy link
Member

Right now the logging situation is a bit ad-hoc. There is the Nest logger, a few random console logs, and some other logging done when the proxy servers start up on bootstrap. Then also optional logging by TypeORM.

There needs to be a single logger through which all logging passes. It should be injectable but also available outside the context of the Nest lifecycle.

This will then allow better control of logging and enable different logging strategies in production / dev.

@michaelbromley
Copy link
Member Author

Proposal

Ultimately, a production application will require a robust logging solution such as Winston. However, I am reluctant to bundle Winston in the core because:

  1. It is overkill for the eval / getting started use-case
  2. Logging requirements will be many and varied, and by coupling to Winston in particular, we will be limiting the flexibility of the logging capabilities.
  3. We'll end up either having to expose large portions of the Winston API for configuration, or effectively requiring Winston as a peer dependency.

A better solution is to define an interface and ship a default console logger with the core.

Then if a user wants to use Winston (or anything else) they wrap it into the shape of the VendureLogger interface.

Requirements

  • The logger must be available globally, i.e. it does not rely on the Nest DI.
  • If at the same time there is some way to mock it for testing, this would be ideal
  • The logger should be a single instance which is configured at bootstrap time, and then whenever it is imported, this configured instance is the one used.

michaelbromley added a commit that referenced this issue Apr 17, 2019
michaelbromley added a commit that referenced this issue Apr 17, 2019
michaelbromley added a commit that referenced this issue Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant