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

Some way to send borrowed strings to an Rfc3164 logger? #41

Closed
daboross opened this issue Jun 18, 2018 · 1 comment
Closed

Some way to send borrowed strings to an Rfc3164 logger? #41

daboross opened this issue Jun 18, 2018 · 1 comment

Comments

@daboross
Copy link

Right now the message type for syslog::Logger is a type parameter on the type itself. This forces me to only ever use one type of message on the logger, when it seems like it could otherwise handle multiple.

My main annoyance with this is trying to send an &str to a logger, and store that logger within a structure. The type would be something like Logger<LoggerBackend, &str, Formatter3164>, but I can't find an appropriate lifetime for &str. I need to be able to send it borrowed strings from different points in the program, and those strings have different lifetimes since I'm borrowing them from different places.

Would it be possible to refactor the Logger struct to no longer be limited to one single message type? This would clear up some other problems like wanting to send an &str in some places and std::fmt::Arguments in others.

@Geal
Copy link
Owner

Geal commented Nov 1, 2019

this is done in 7b1be00 and will be available in version 5. Now all of the logging functions have a signature like this pub fn info<T>(&mut self, message: T) -> Result<()> where F: LogFormat<T>

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

2 participants