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.
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>
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 likeLogger<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 andstd::fmt::Arguments
in others.