Use more tracing features

This commit is contained in:
Joscha 2023-08-04 18:51:12 +02:00
parent 4f7d4f3204
commit a1d48f6fd3
3 changed files with 5 additions and 4 deletions

View file

@ -10,7 +10,7 @@ pub struct Config {}
impl Config {
pub fn load(path: &Path) -> anyhow::Result<Self> {
info!("Loading config from {}", path.display());
info!(path = %path.display(), "Loading config");
Ok(match fs::read_to_string(path) {
Ok(str) => toml::from_str(&str)?,
Err(e) if e.kind() == ErrorKind::NotFound => {

View file

@ -38,7 +38,8 @@ struct Args {
fn set_up_logging(verbose: bool) {
if verbose {
tracing_subscriber::fmt()
.with_max_level(LevelFilter::DEBUG)
.with_max_level(LevelFilter::TRACE)
.pretty()
.init();
} else {
tracing_subscriber::fmt()

View file

@ -29,7 +29,7 @@ async fn open_db(db_path: &Path) -> sqlx::Result<SqlitePool> {
.create_if_missing(true)
.optimize_on_close(true, None);
info!("Opening db at {}", db_path.display());
info!(path = %db_path.display(), "Opening db");
let pool = SqlitePoolOptions::new().connect_with(options).await?;
debug!("Applying outstanding db migrations");
@ -39,7 +39,7 @@ async fn open_db(db_path: &Path) -> sqlx::Result<SqlitePool> {
}
fn open_repo(repo_path: &Path) -> anyhow::Result<ThreadSafeRepository> {
info!("Opening repo at {}", repo_path.display());
info!(path = %repo_path.display(), "Opening repo");
Ok(ThreadSafeRepository::open(repo_path)?)
}