From 311b48924d2e20deb8733a2b94a531f55a83e205 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 23 Aug 2020 21:26:02 +0530 Subject: add logging --- src/db.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/db.rs') diff --git a/src/db.rs b/src/db.rs index a5c0f85..4025e12 100644 --- a/src/db.rs +++ b/src/db.rs @@ -1,11 +1,14 @@ use anyhow::Result; +use log::{debug, info}; use rusqlite::{Connection, OpenFlags, NO_PARAMS}; +use std::fmt; use std::path::Path; -pub fn init_db>(p: P) -> Result { +pub fn init_db + fmt::Display>(p: P) -> Result { + debug!("Looking for database at `{}`", p); let conn = Connection::open_with_flags( - p, + &p, OpenFlags::SQLITE_OPEN_CREATE | OpenFlags::SQLITE_OPEN_READ_WRITE, )?; conn.execute( @@ -15,5 +18,6 @@ pub fn init_db>(p: P) -> Result { )", NO_PARAMS, )?; + info!("SQLite3 database `{}` initialized", &p); return Ok(conn); } -- cgit v1.2.3