forked from winstonjs/winston
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix] Better handling of
new Error(string)
throughout the pipeline(…
…s). Fixes winstonjs#1338, winstonjs#1486 (winstonjs#1562) * [tiny dist] Whitespace. package-lock.json * [test] Add E2E integration tests with logform `errors` format. * [test] 5:00pm. Press return. * [fix test] More E2E errors coverage. * [test] Test custom error properties. * [tiny doc] Make note of duplicate coverage in `logger`. Update minor formatting. * [test] All E2E tests work except for one... * [fix test doc] All 14 variations of handling `new Error()` now work as most folks expect. * [tiny] Fix up file header. * [dist] Bump to `[email protected]` * [fix tiny] Whitespace. * s/req_id/requestId/ * [fix test] Address PR comments. Add test coverage for defaultMeta over .child(additionalMeta)
- Loading branch information
Showing
8 changed files
with
528 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const { createLogger, format, transports } = require('../'); | ||
const { combine, errors, json } = format; | ||
|
||
const logger = createLogger({ | ||
format: combine( | ||
errors({ stack: true }), | ||
json() | ||
), | ||
transports: [ | ||
new transports.Console(), | ||
] | ||
}); | ||
|
||
logger.warn(new Error('Error passed as info')); | ||
logger.log('error', new Error('Error passed as message')); | ||
|
||
logger.warn('Maybe important error: ', new Error('Error passed as meta')); | ||
logger.log('error', 'Important error: ', new Error('Error passed as meta')); | ||
|
||
logger.error(new Error('Error as info')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.