summaryrefslogtreecommitdiff
path: root/src/bin/cli/mod.rs
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2021-09-04 14:48:36 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2021-09-04 14:48:36 +0100
commit614014041e493e1a4b6d5729320b42af39d89c68 (patch)
tree8f417718b3ac318a883b5e324f2c567914e22426 /src/bin/cli/mod.rs
parente11811d6425a8caced83fd2d5ebce55b04c6c1c2 (diff)
downloadsubplot-614014041e493e1a4b6d5729320b42af39d89c68.tar.gz
tracing: Add a bunch of TRACE level tracing
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'src/bin/cli/mod.rs')
-rw-r--r--src/bin/cli/mod.rs20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/bin/cli/mod.rs b/src/bin/cli/mod.rs
index c686cab..5da5bf9 100644
--- a/src/bin/cli/mod.rs
+++ b/src/bin/cli/mod.rs
@@ -4,15 +4,29 @@
use anyhow::Result;
use serde::Serialize;
-use subplot::{DataFile, Document, Style, SubplotError};
-
use std::convert::TryFrom;
+use std::fmt::Debug;
use std::path::Path;
use std::str::FromStr;
+use subplot::{DataFile, Document, Style, SubplotError};
+use tracing::{event, instrument, Level};
-pub fn load_document<P: AsRef<Path>>(filename: P, style: Style) -> Result<Document> {
+#[instrument(level = "trace")]
+pub fn load_document<P>(filename: P, style: Style) -> Result<Document>
+where
+ P: AsRef<Path> + Debug,
+{
let filename = filename.as_ref();
let base_path = subplot::get_basedir_from(filename);
+ event!(
+ Level::TRACE,
+ ?filename,
+ ?base_path,
+ "Loading document based at `{}` called `{}` with {:?}",
+ base_path.display(),
+ filename.display(),
+ style
+ );
let doc = Document::from_file(&base_path, filename, style)?;
Ok(doc)