You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suggest we implement some basic logging - this seems to be a popular crate and enables clients of our library to implement the actual logging backend: https://crates.io/crates/log/
Possible use cases:
It would be useful to log some INFO or WARNING if variables of templates are not set for example.
'INFO: rendering template "X"'
'WARN: template variable "X" uninitialized'
We could use it for debugging
'DEBUG: parsed token "X" at ..'
I think we could even make this optional in our cargo [features] section. If someone compiles without that feature, we can fallback to real noop-macros. To optimize the runtime costs for different usages, we could even have two compile flags "log" < "debug", where debug implies log, but not otherwise. Our tests could then benefit of some debug logging.
Example from their documentation:
#[macro_use]externcrate log;pubfnshave_the_yak(yak:&Yak){info!(target:"yak_events","Commencing yak shaving for {:?}", yak);loop{matchfind_a_razor(){Ok(razor) => {info!("Razor located: {}", razor);
yak.shave(razor);break;}Err(err) => {warn!("Unable to locate a razor: {}, retrying", err);}}}}
I don't know if we really need LogLevel::Error, because I think we should just return a Result::Err in these cases - so I don't expect us to use this log level, but anyway, here is the list from the log-crate:
pubenumLogLevel{Error,// log OR debugWarn,// log OR debugInfo,// log OR debugDebug,// debugTrace,// debug}
What do you think?
The text was updated successfully, but these errors were encountered:
I suggest we implement some basic logging - this seems to be a popular crate and enables clients of our library to implement the actual logging backend:
https://crates.io/crates/log/
Possible use cases:
I think we could even make this optional in our cargo [features] section. If someone compiles without that feature, we can fallback to real noop-macros. To optimize the runtime costs for different usages, we could even have two compile flags "log" < "debug", where debug implies log, but not otherwise. Our tests could then benefit of some debug logging.
Example from their documentation:
I don't know if we really need LogLevel::Error, because I think we should just return a Result::Err in these cases - so I don't expect us to use this log level, but anyway, here is the list from the log-crate:
What do you think?
The text was updated successfully, but these errors were encountered: