-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Field 'message' from logged object ignored by Winston #1486
Comments
this is related to #1510 - if the first argument is an object, it gets |
Thank you for reporting this issue. The functionality is by design, but we updated examples & documentation in #1554 to make this less of a "gotcha". In this particular case if you use const winston = require('winston');
const logger = winston.createLogger({
level: process.env.NODE_ENV === 'production' ? 'info' : 'debug',
format: winston.format.combine(
winston.format.splat(),
winston.format.simple()
),
transports: [new winston.transports.Console()],
});
const email = {
subject: 'Hello, World!',
message: 'Hello mr.World, sorry, but you will not see this message in the console.',
};
logger.debug('logger.debug: %j', email); This is very similar to the |
…s). Fixes #1338, #1486 (#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 `logform@2.1.0` * [fix tiny] Whitespace. * s/req_id/requestId/ * [fix test] Address PR comments. Add test coverage for defaultMeta over .child(additionalMeta)
* [doc] Document the solution to winstonjs#1486. * [doc] Show both in example. * [doc] Update the examples.
…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 `logform@2.1.0` * [fix tiny] Whitespace. * s/req_id/requestId/ * [fix test] Address PR comments. Add test coverage for defaultMeta over .child(additionalMeta)
Please tell us about your environment:
winston
version?winston@2
winston@3.1.0
node -v
outputs: v10.7.0What is the problem?
looks like Winston ignores field with name
message
Output:
What do you expect to happen instead?
I expect all the object will be displayed in the log without sudden exceptions
The text was updated successfully, but these errors were encountered: