#[macro_use] extern crate serde_derive; #[macro_use] extern crate log; use clap::ArgMatches; use clappconfig::AppConfig; use failure::Fallible; #[derive(Serialize, Deserialize, Debug, Default)] #[serde(default)] struct Config { foo: u32, bar: u32, } impl AppConfig for Config { type Init = Config; fn logging(&self) -> &str { "info" } fn configure<'a>(self, _clap: &ArgMatches<'a>) -> Fallible { Ok(self) } } fn main() -> Fallible<()> { let cfg = Config::init("Foo", "examples/foo.json", None)?; trace!("Trace message"); debug!("Debug message"); info!("Info message"); warn!("Warn message"); error!("Error message"); println!("Welcome to foo, config:\n{:#?}", cfg); Ok(()) }