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() does not work as expected #51

Closed
alesmenzelsocialbakers opened this issue Jul 31, 2018 · 2 comments
Closed

Splat() does not work as expected #51

alesmenzelsocialbakers opened this issue Jul 31, 2018 · 2 comments

Comments

@alesmenzelsocialbakers
Copy link

Current behavior>
Splat does not correcly add meta key with the rest of arguments when no interpolation is needed.

Expected behavior:
All other arguments are added under the meta key.

Reproduction:

const { createLogger, format, transports } = require('winston');
const { SPLAT, LEVEL } = require('triple-beam');

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

logger.error('one %s', 'two', 'three');
// {"level":"error","message":"one two","meta":"three"}

logger.error('one %s', 'two', 'three', 'forth');
// {"level":"error","message":"one two","meta":["three","forth"]}

logger.error('one', 'two', 'three');
// {"level":"error","message":"one"}

logger.error('one', 'two', 'three', 'forth');
// {"level":"error","message":"one"}
@WhiteTomX
Copy link

There is a PR already #49. Would appreciate it very much!

@indexzero
Copy link
Member

Fixed by #49. Thanks for the contribution @WhiteTomX!

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

3 participants