Skip to content

Conversation

@tagyoureit
Copy link
Contributor

@tagyoureit tagyoureit commented Feb 27, 2019

This is a PR for the idea I posted on the main Winston issues page: winstonjs/winston#1408

Basically the idea is separate the splat (which should be a known number of tokens) from anything which is additional/supplemental. The additional/supplemental tokens are pushed to info.meta and can be processed by a new transform such as the captureAllMeta transform that I've included.

These changes should have no impact on the existing implementation and will extend/add new functionality that was previously present in v2.

@tagyoureit
Copy link
Contributor Author

Going through the output of my app I found another test case where I would solely log a JSON object like logger.info({an:"object"}. I will test this out (and add a test case for it).

@tagyoureit
Copy link
Contributor Author

tagyoureit commented Feb 28, 2019

@DABH I think I've worked up something that makes sense...
What if the existing metadata stays as is and its primary purpose is to capture data for other uses (eg pass to Mongo).

The splat approach would be more of a purely visual logging solution. It would assume any additional splat passed would be presented in a console log or file and not stored anywhere else as an object.

User could either configure logger with :

combine(
   ..., 
   winston.format.metadata(),
   ...
)

--or--

combine(
   ...,
   winston.format.splat(),
   winston.format.captureAllMeta()
   ...
)

Does that make sense? I don't foresee them being used together but provide two different approaches/outputs.

@tagyoureit
Copy link
Contributor Author

Closing this because I pushed up some mangled code.

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

Successfully merging this pull request may close these issues.

1 participant