Skip to content
This repository was archived by the owner on Apr 21, 2022. It is now read-only.

Ambient Meta Support#60

Merged
smusali merged 8 commits intomasterfrom
ambientdMeta
Aug 6, 2019
Merged

Ambient Meta Support#60
smusali merged 8 commits intomasterfrom
ambientdMeta

Conversation

@vilyapilya
Copy link
Copy Markdown
Contributor

@vilyapilya vilyapilya commented Jul 13, 2019

Add methods that would add and remove an ambient meta property to a logger. The ambient meta can be either a string or an object. If it is an object, it has to be json parseable and it will be parsed two levels deep and the rest will be stringified. (One of the levels is reserved for the 'ambientMeta' field)

If a logger which has an ambient meta sends a log message in a string representation, then that message will be transformed into an object: {message: {passed log line}, ambinetMeta: meta}.

If a logger which has an ambient meta sends a log message in an object representation, then this object will have an additional field - 'ambientMeta'.

Note: Addressing #29

vilyapilya added 2 commits July 12, 2019 18:00
@smusali smusali changed the title Add ambient meta. Ambient Meta Support Jul 15, 2019
Copy link
Copy Markdown
Contributor

@smusali smusali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should be able to provide the option to the customers to add properties one-by-one or group-by-group; so, in that case, having the followings would be nice:

  • addProperty(key, value)
  • addProperties({ ... }) // key-value pairs
  • removeProperty(key)
  • removeProperties([ ... ]) // list of keys - if undefined, delete all

I think, we should discuss this further.

Comment thread lib/logger.js Outdated
Comment thread lib/logger.js Outdated
@vilyapilya
Copy link
Copy Markdown
Contributor Author

I think we should be able to provide the option to the customers to add properties one-by-one or group-by-group; so, in that case, having the followings would be nice:

  • addProperty(key, value)
  • addProperties({ ... }) // key-value pairs
  • removeProperty(key)
  • removeProperties([ ... ]) // list of keys - if undefined, delete all

I think, we should discuss this further.

Sounds good. But I think this additional optimization should be a separate PR not in this one anyway.

@smusali
Copy link
Copy Markdown
Contributor

smusali commented Aug 6, 2019

I think we should be able to provide the option to the customers to add properties one-by-one or group-by-group; so, in that case, having the followings would be nice:

  • addProperty(key, value)
  • addProperties({ ... }) // key-value pairs
  • removeProperty(key)
  • removeProperties([ ... ]) // list of keys - if undefined, delete all

I think, we should discuss this further.

Sounds good. But I think this additional optimization should be a separate PR not in this one anyway.

Agree but you still have to rename the properties :)

@smusali smusali merged commit 062dc29 into master Aug 6, 2019
@smusali smusali deleted the ambientdMeta branch August 6, 2019 19:06
This was referenced Aug 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants