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

Logger argument seems off #3363

Closed
jedborovik opened this issue Jul 20, 2019 · 2 comments · Fixed by #3567
Closed

Logger argument seems off #3363

jedborovik opened this issue Jul 20, 2019 · 2 comments · Fixed by #3567

Comments

@jedborovik
Copy link

Environment

Knex version: 0.19.0
Database + version: postgres
OS: macOS

If issue is about TypeScript definitions, tag @lorefnon.

Bug

Logger type definition seems off. It says the argument is a string, however, inspecting it is a more complex object, with sql, bindings, and various other fields (sorry not sure what the correct type is).

@lorefnon
Copy link
Collaborator

Yeah, there seems to be some inconsistency here.

The default logger implementation supports logging objects/arrays etc. when level is debug (because it forwards directly to console.log) but not for other levels (because colorette supports only string.

> knex.client.logger.warn({a: 10})
[object Object]

I think we can normalize logger to pass the argument through util.inspect before applying colorette and update the typedefs to match that of util.inspect.

@kibertoad
Copy link
Collaborator

Released in 0.20.4

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 a pull request may close this issue.

3 participants