Skip to content

chore: clean up logging#572

Merged
bchrobot merged 2 commits into
masterfrom
chore/clean-up-logging
Mar 1, 2020
Merged

chore: clean up logging#572
bchrobot merged 2 commits into
masterfrom
chore/clean-up-logging

Conversation

@bchrobot
Copy link
Copy Markdown
Member

Winston handles .error(message, err) okay, but not .error(err) by itself. For reability we also
want to make sure the provided message ends with a space so that the concatenated message from the
error is separate.

Due to a winston regression introduced in 3.x, we cannot pass other meta information after the error
without passing error.message and error.stack explicitly. This means we may lose additional error
properties. We cannot destructure the error either (non-iterable properties).

A better fix would be to write a custom log formatter that is error-aware. There are a few examples
on GitHub, but none that looked straightforward. We don't want to break JSON logging and parsing.

https://medium.com/@stieg/winston-3-and-logging-error-stacks-cf70b2111289
winstonjs/winston#1351
winstonjs/winston#1498
winstonjs/winston#1338
winstonjs/winston#1562

Winston handles .error(message, err) okay, but not .error(err) by itself. For reability we also
want to make sure the provided message ends with a space so that the concatenated message from the
error is separate.

Due to a winston regression introduced in 3.x, we cannot pass other meta information after the error
without passing error.message and error.stack explicitly. This means we may lose additional error
properties. We cannot destructure the error either (non-iterable properties).

A better fix would be to write a custom log formatter that is error-aware. There are a few examples
on GitHub, but none that looked straightforward. We don't want to break JSON logging and parsing.
@bchrobot bchrobot force-pushed the chore/clean-up-logging branch from b19c7cb to 5c003e4 Compare February 25, 2020 19:02
@bchrobot bchrobot requested a review from ben-pr-p February 26, 2020 11:49
@bchrobot bchrobot merged commit 5e8ef0c into master Mar 1, 2020
@bchrobot bchrobot deleted the chore/clean-up-logging branch March 1, 2020 00:01
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