summary refs log tree commit diff stats
path: root/src/db.rs
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2020-05-26 20:37:23 -0400
committerBen Morrison <ben@gbmor.dev>2020-05-26 23:52:53 -0400
commitcf3b6628ce4deb429fad407829b425a7377e2b5d (patch)
treee1849e20da3f80e73aad15ff195006ab0a422e8d /src/db.rs
parent16fbf516e3b28d19570dd6e93e63b0efb9c249ff (diff)
downloadclinte-cf3b6628ce4deb429fad407829b425a7377e2b5d.tar.gz
hiding some log messages behind -v flag
Diffstat (limited to 'src/db.rs')
-rw-r--r--src/db.rs18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/db.rs b/src/db.rs
index 86875e2..935f1f9 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -1,5 +1,7 @@
 use std::time;
 
+use crate::conf;
+
 const DB_PATH: &str = "/usr/local/clinte/clinte.db";
 
 #[derive(Debug)]
@@ -18,7 +20,11 @@ pub struct Conn {
 impl Conn {
     pub fn init(path: &str) -> rusqlite::Connection {
         let start = time::Instant::now();
-        log::info!("Connecting to database");
+
+        if *conf::DEBUG {
+            log::info!("Connecting to database");
+        }
+
         let conn = rusqlite::Connection::open_with_flags(
             path,
             rusqlite::OpenFlags::SQLITE_OPEN_FULL_MUTEX
@@ -38,10 +44,12 @@ impl Conn {
         )
         .expect("Could not initialize DB");
 
-        log::info!(
-            "Database connection established in {}ms",
-            start.elapsed().as_millis()
-        );
+        if *conf::DEBUG {
+            log::info!(
+                "Database connection established in {}ms",
+                start.elapsed().as_millis()
+            );
+        }
 
         conn
     }