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

Log routing according to metadata #18

Open
meyercm opened this issue May 24, 2016 · 2 comments
Open

Log routing according to metadata #18

meyercm opened this issue May 24, 2016 · 2 comments

Comments

@meyercm
Copy link
Contributor

meyercm commented May 24, 2016

In other logging settings, I've found value in being able to redirect certain log statements to individual files e.g.: in one application that manages 3 identical serial devices- my logging is configured to create logs <device1>.log, <device2>.log, <device3>.log, each with the serial traffic for just one device, rather than an interleaved log that has UI considerations, DB changes, etc.

Has this idea already been floated? Currently, it looks like a config stanza is needed per file; would it be possible to have a single config stanza create/append to multiple files, and specify a metadata wildcard in the :path key, like such:

config :logger, :serial_devices,
  path: "/path/to/logs/device_$metadata[$device_id].log",
  level: :info

A different, but related capability: being able to deliver messages to a log based on the presence of a metadata key:

config :logger, :ui_logging,
  path: "/path/to/logs/ui.log"
  level: :info,
  required_metadata: [application: :ui]  # or a custom key

There is probably a clever syntax for specifying the filter better than what I have- while I'm suggesting a syntax to be constructive, I'm not wedded to it, and I think there's tons of room for improvement.

Generally, what's the reaction to this idea? Is it something the community would be open to including in this project?

@OvermindDL1
Copy link

Looks like this has been done and merged, any chance on a new hex.pm version with it? :-)

@isaacsanders
Copy link

@meyercm Is this issue resolved?

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