improve error logging
This commit is contained in:
parent
0724613e36
commit
a9692e9f42
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -3,7 +3,7 @@ name = "systemd-crontab-generator"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"cronparse 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"kernlog 0.1.2",
|
||||
"kernlog 0.2.0",
|
||||
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"md5 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pgs-files 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -16,7 +16,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "kernlog"
|
||||
version = "0.1.2"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -38,7 +38,7 @@ macro_rules! try_ {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
kernlog::init().unwrap();
|
||||
log::set_logger(|filter| kernlog::KernelLog::init_level(log::LogLevelFilter::Error, filter)).unwrap();
|
||||
|
||||
let dest_dir = match env::args().nth(1) {
|
||||
None => {
|
||||
|
@ -28,7 +28,7 @@ pub fn process_crontab_file<T: ToCrontabEntry, P: AsRef<Path>, D: AsRef<Path>>(p
|
||||
Ok(CrontabEntry::EnvVar(EnvVarEntry(name, value))) => { env.insert(name, value); },
|
||||
Ok(data) => match generate_systemd_units(data, &env, path.as_ref(), dstdir.as_ref()) {
|
||||
Ok(_) => (),
|
||||
Err(err) => error!("{}", err)
|
||||
Err(err) => error!("error generating unit from {}: {}", path.as_ref().display(), err)
|
||||
},
|
||||
Err(err @ CrontabFileError { kind: CrontabFileErrorKind::Io(_), .. }) => warn!("error accessing file {}: {}", path.as_ref().display(), err),
|
||||
Err(err @ CrontabFileError { kind: CrontabFileErrorKind::Parse(_), .. }) => warn!("skipping file {} due to parsing error: {}", path.as_ref().display(), err),
|
||||
|
Loading…
Reference in New Issue
Block a user