From c5ea65393d9b8000d68cf8c2f887f22bdae81222 Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Tue, 26 May 2020 19:43:37 -0400 Subject: logging changes: Rather than using a new logfile for each invocation, a single logfile called `/tmp/clinte_$USER.log` will be used, with later invocations appending to the previous messages. Also removed some unnecessary `use` statements relating to the `log` crate and its macros. Leaving the macro calls namespaced to `log::` makes it clearer what the behavior is. --- src/main.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index e2f793b..faef1b3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,6 @@ use std::time; extern crate lazy_static; use clap; -use log::info; mod db; mod ed; @@ -25,17 +24,17 @@ fn main() -> error::Result<()> { let start = time::Instant::now(); logging::init()?; - info!("clinte starting up!"); + log::info!("clinte starting up!"); println!("clinte v{}", clap::crate_version!()); println!("a community notices system"); println!(); let db = db::Conn::new(); - info!("Startup completed in {:?}ms", start.elapsed().as_millis()); + log::info!("Startup completed in {:?}ms", start.elapsed().as_millis()); if arg_matches.subcommand_matches("post").is_some() { - info!("New post..."); + log::info!("New post..."); posts::create(&db)?; } else if arg_matches.subcommand_matches("update").is_some() { let id: u32 = if let Some(val) = arg_matches.subcommand_matches("update_handler") { @@ -43,7 +42,7 @@ fn main() -> error::Result<()> { } else { 0 }; - info!("Updating post ..."); + log::info!("Updating post ..."); posts::update_handler(&db, id)?; } else if arg_matches.subcommand_matches("delete").is_some() { let id: u32 = if let Some(val) = arg_matches.subcommand_matches("update_handler") { @@ -51,7 +50,7 @@ fn main() -> error::Result<()> { } else { 0 }; - info!("Deleting post"); + log::info!("Deleting post"); posts::delete_handler(&db, id)?; } -- cgit 1.4.1-2-gfad0