-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed as not planned
Closed as not planned
Copy link
Description
Please tell us about your environment:
winstonversion?-
winston@2 -
winston@3
-
node -voutputs: v8.11.3- Operating System? macOS
- Language? ES6/7
What is the problem?
If you just pass an object to a winston logger configured as the example it is being displayed as [Object object].
With a text in front and using the object as a second parameter it works.
Code:
import { createLogger, format, transports } from 'winston';
const logger = createLogger({
transports: [
new transports.Console({
format: format.simple()
})
]
});
const object = {
some: 'property',
another: 'property'
};
// Does not work
logger.info(object);
// Works
logger.info('Test', object);Output
info: [object Object]
info: Test {"some":"property","another":"property"}
What do you expect to happen instead?
I expect the object to be converted to a string if I supply it as the first parameter.
Output
info: {"some":"property","another":"property"}
info: Test {"some":"property","another":"property"}
lincolnaleixo
Metadata
Metadata
Assignees
Labels
No labels