-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix: log Errors on winston ^2.3.1 #13
Conversation
fbc3464
to
92873b9
Compare
helpers/cloneErrorProxy.js
Outdated
@@ -0,0 +1,43 @@ | |||
'use strict' | |||
|
|||
const LOGGING_LEVELS = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied LOGGING_LEVELS
from src/helpers/assertLevel.js
because this file is going to be deprecated when the bug is solved on winston
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the above a code comment
92873b9
to
fe3deda
Compare
index.js
Outdated
transports, | ||
}) | ||
|
||
const logger = cloneErrorProxy(unwrappedLogger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a comment in this file as well as to why we're doing that
helpers/cloneErrorProxy.js
Outdated
'silly', | ||
] | ||
|
||
// FIX: winston from 2.3.1 until 2.4.0 doesn't log Error objects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did this comment miss the word "because" somewhere? i don't fully understand it.
clean approach! i just want two more comments ;) |
after winston solves its bug this PR gets deprecated
index.js
Outdated
@@ -14,6 +14,9 @@ const unwrappedLogger = new (winston.Logger)({ | |||
transports, | |||
}) | |||
|
|||
// We are proxying winston logger because versions from 2.3.0 until 2.4.0 | |||
// does not log Error objects. The proxy is going to be DEPRECATED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: does -> do
but ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed :)
5481d2f
to
95b5f2e
Compare
Should we have used this instead? |
This is pcool man! It will be an improvement to our system, we could even add the Add a new card to me and close this PR if you want me to patch |
@rodrigo4244 @kewitz you make a decision on what is best and report (share in the meeting) |
This is deprecated because of #14 The code is archived on the following tag: https://github.com/invisible-tech/logger/releases/tag/archive%2FcloneErrorProxy |
Description
This PR fixes the issue winstonjs/winston#1178 from
winston
using a proxy on our logger.Test plan
mkdir /tmp/x;cd /tmp/x;npm init --yes
)yarn add invisible-tech/logger#rgo/fix-winston
)repro.js
withconst logger = require('@invisible/logger');logger.error(Error('Errors can be cool'))
node repro.js
The output is an error object "equals" to the one returned on
[email protected]
.It is not only the error message as on the card: https://trello.com/c/9p0K6DFe/776-logging-error-objects