From 7de6914863d54bca6aba75514591f1a88bbf92ce Mon Sep 17 00:00:00 2001 From: James Prestwich Date: Mon, 30 Aug 2021 09:55:37 -0700 Subject: [PATCH] feature: log db status at agent bootup --- rust/optics-base/src/db/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rust/optics-base/src/db/mod.rs b/rust/optics-base/src/db/mod.rs index 4b7651d5c..afe29d13c 100644 --- a/rust/optics-base/src/db/mod.rs +++ b/rust/optics-base/src/db/mod.rs @@ -1,6 +1,7 @@ use color_eyre::eyre::{Result, WrapErr}; use rocksdb::{Options, DB}; use std::path::Path; +use tracing::info; /// Shared functionality surrounding use of rocksdb pub mod persistence; @@ -14,6 +15,14 @@ pub fn from_path(db_path: &str) -> Result { let mut path = Path::new(".").canonicalize()?; path.extend(&[db_path]); + match path.is_dir() { + true => info!( + "Opening existing db at {path}", + path = path.to_str().unwrap() + ), + false => info!("Creating db a {path}", path = path.to_str().unwrap()), + } + let mut opts = Options::default(); opts.create_if_missing(true);