Skip to content
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

splat() spreads individual characters of unreferenced string into result #109

Open
akloeber opened this issue Jun 22, 2020 · 1 comment
Open

Comments

@akloeber
Copy link

If there is an additional string parameter that is not insert via %s into the message template, its characters are inserted individually as properties into the result:

const {createLogger, format, transports} = require('winston');
const logger = createLogger({
  level: 'info',
  format: format.combine(format.splat(), format.json()),
  transports: [new transports.Console()],
});

logger.error('one %s', 'two', 'three');
// {"0":"t","1":"h","2":"r","3":"e","4":"e","level":"error","message":"one two"}

While this is in compliance with the documentation at https://github.com/winstonjs/logform#splat it is still not expected. The behavior should be aligned to what console.log() does where additional parameters are just printed as they are.
Issue #51 suggests that they should be collected into a meta-property which would also be fine as they could then be used in a custom printf transformation.

Versions:
[email protected]
[email protected]

@Y-qwq
Copy link

Y-qwq commented Jan 6, 2022

+1

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

No branches or pull requests

2 participants