Is it possible to do something like this in macros of the log crate?
enum ErrorKind {
KindA,
KindB,
KindC,
}
error!(ErrorKind::KindA, "Unable to do A.");
In the log function of the custom logger:
fn log(&self, record: &Record) {
if self.enabled(record.metadata()) {
match record.custom_args.kind {
KindA => handle_kind_a(),
KindB => handle_kind_b(),
KindC => handle_kind_c(),
}
}
}