Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

add flag to log to syslog #5

Open
yoshuawuyts opened this issue Oct 12, 2018 · 4 comments
Open

add flag to log to syslog #5

yoshuawuyts opened this issue Oct 12, 2018 · 4 comments

Comments

@yoshuawuyts
Copy link
Collaborator

yoshuawuyts commented Oct 12, 2018

We should add a {flag, method, option} to enable logging to the syslog provider.

An interesting thing here is that systemd sets $JOURNAL_STREAM when it manages a process, so we could catch that and automatically switch it over to the syslog provider. This opens a few questions:

  1. Do we need to add a flag for this? Is detecting an env var enough?
  2. Should we remove the --pretty option, and always use a pretty-printer. Right now there's not too much difference between the two anyway.
  3. Can we still apply filtering using the env logger provider?

Refs

@killercup
Copy link

killercup commented Oct 12, 2018 via email

@epage
Copy link
Member

epage commented Oct 12, 2018

Is the intention of this crate to be focused on CLIs or to be a general logging configuration crate?

If CLIs, I'd suggest sysalog support would be outside of the scope. I can't imagine rg, fd, tokei, cobalt, or many other CLIs would ever want syslog support, that seems more intended for daemons and the like.

But who knows, maybe there is something I'm missing here.

@yoshuawuyts
Copy link
Collaborator Author

If CLIs, I'd suggest sysalog support would be outside of the scope. I can't imagine rg, fd, tokei, cobalt, or many other CLIs would ever want syslog support, that seems more intended for daemons and the like.

Good point! -- right now I'm building out a service, and I think you're right it doesn't make sense there. Perhaps we ought to create one clap-log-flag and a clap-slog-flag crate? Or perhaps feature flag it to disable?

Good idea. Would probably be easiest if we switched to a crate like slog that has drains for syslog and journald readily available.

Ideally we could still support inline calls to log::info!() and the like. For example tokio uses those, and they can be super useful to help with debugging.

@epage
Copy link
Member

epage commented Oct 13, 2018

Ideally we could still support inline calls to log::info!() and the like. For example tokio uses those, and they can be super useful to help with debugging.

Slog has adapters for these situations

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants