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

Expose a logger interface #2204

Closed
Sytten opened this issue Apr 16, 2020 · 3 comments
Closed

Expose a logger interface #2204

Sytten opened this issue Apr 16, 2020 · 3 comments
Assignees
Labels
kind/improvement An improvement to existing feature and code. tech/typescript Issue for tech TypeScript.
Milestone

Comments

@Sytten
Copy link
Contributor

Sytten commented Apr 16, 2020

Problem

Currently there are a lot of console.error calls in the NodeEngine and prisma client. This is problematic since it will not forward those logs to the proper transports.

Solution

It would be better off to have a general logging interface with a default implementation to console that users can override to provider their own logger like winston.

Alternatives

Collect logs from STDOUT and send them.

EDIT1:
Another alternative is to use the .on method ad explained here: https://github.com/prisma/specs/tree/master/prisma-client-js#logging

@timsuchanek
Copy link
Contributor

Thanks for creating the issue. This should probably just tie into the existing log levels have defined here: https://github.com/prisma/specs/tree/master/prisma-client-js#logging

Note, that right now you can already do prisma.on('info', e => logger.log(e.message))

@timsuchanek timsuchanek added kind/improvement An improvement to existing feature and code. process/candidate labels Apr 16, 2020
@Sytten
Copy link
Contributor Author

Sytten commented Apr 16, 2020

Agreed, it would be a duplicate log for the user, but its a work around. I will update the issue.

@janpio janpio added the tech/typescript Issue for tech TypeScript. label Apr 21, 2020
@janpio janpio added this to the Beta 4 milestone Apr 21, 2020
@divyenduz divyenduz modified the milestones: Beta 4, Beta 5 May 4, 2020
@janpio janpio modified the milestones: Beta 5, Beta 6 May 12, 2020
@janpio janpio modified the milestones: Beta 6, Beta 7, Beta 8 May 26, 2020
@Sytten
Copy link
Contributor Author

Sytten commented Jun 5, 2020

@timsuchanek Should I open an issue to document that?

@janpio janpio modified the milestones: Beta 9, New Beta 9 Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/improvement An improvement to existing feature and code. tech/typescript Issue for tech TypeScript.
Projects
None yet
Development

No branches or pull requests

4 participants