Skip to content

Commit

Permalink
fix: tracing initialization missing (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatisseB authored Jun 25, 2024
1 parent 1e87530 commit 2cebcdd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/bin/lgc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ use lgc::commands::{
services::ServicesCommands, validate::ValidateCommand,
};
use logcraft_common::configuration::{ProjectConfiguration, LGC_CONFIG_PATH};
use tracing::Level;
use tracing_subscriber::EnvFilter;
use std::path::PathBuf;

#[forbid(unsafe_code)]
Expand Down Expand Up @@ -74,6 +76,14 @@ impl LogCraftCli {
let matches = LogCraftCli::command().styles(styles).get_matches();
let mut cli = LogCraftCli::from_arg_matches(&matches)?;

tracing_subscriber::fmt()
.with_writer(std::io::stdout)
.with_target(false)
.without_time()
.with_env_filter(EnvFilter::from_env("LGC_LOG"))
.with_max_level(Level::INFO)
.init();

// Load configuration
match cli.commands {
LogCraftCommands::Init(cmd) => return cmd.run(),
Expand Down
4 changes: 2 additions & 2 deletions src/commands/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl ValidateCommand {
let check = serv.validate_code(&args)?;
if !check.success {
has_err = true;
tracing::error!("`{}`", check.err_message);
tracing::error!("{}", check.err_message);
}
}

Expand All @@ -67,7 +67,7 @@ impl ValidateCommand {
let check = serv.validate_code(&args)?;
if !check.success {
has_err = true;
tracing::error!("`{}`", check.err_message);
tracing::error!("{}", check.err_message);
}
}
}
Expand Down

0 comments on commit 2cebcdd

Please sign in to comment.