trentm / node-bunyan

a simple and fast JSON logging module for node.js services
Other
7.19k stars 518 forks source link

would be nice to have a hierarchical property in child loggers #475

Open davepacheco opened 7 years ago

davepacheco commented 7 years ago

A lot of times, a component will create multiple instances of some library component, sometimes without even knowing it (via a dependency). It would be useful if the log entries reflected the hierarchy.

For example, we've got a web server called "muskie". It uses an RPC client called "moray" in three different places: via its "marlin" client, its "libmanta" client, and its "medusa" client. It would work pretty well to have the top level have name: "muskie", the next level have something like component: "marlin", and the next level would add component: "moray".

If we just changed "component" to work that way, that'd presumably either be a major version bump or an opt-in option on the top-level logger.

trentm commented 7 years ago

I'm waiting on a bunyan ver with the config-and-fields, fields thing (https://github.com/trentm/node-bunyan/issues/460) to consider an option for this.

Note that I've started getting there. I've branch 1.x for maint and #master is now for 2.x work. Mainly it is this config-and-fields, fields change -- that will allow introducing new config vars for stuff like this -- that is behind the major ver bump.