Skip to content

Commit

Permalink
refactor: add log flag (#13)
Browse files Browse the repository at this point in the history
* refactor: add log flag

* chore: remove redundant import
  • Loading branch information
zmalatrax authored Nov 6, 2024
1 parent 1ecc08c commit 0a4fb78
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/brainfuck_vm/src/bin/brainfuck_vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::{
io::{stdin, stdout},
path::PathBuf,
};
use tracing_subscriber::{fmt, EnvFilter};

use brainfuck_vm::{compiler::Compiler, machine::Machine};

Expand All @@ -15,6 +14,8 @@ use brainfuck_vm::{compiler::Compiler, machine::Machine};
struct Args {
#[clap(value_parser, value_hint=ValueHint::FilePath)]
filename: PathBuf,
#[clap(long, default_value = "info")]
log: String,
#[clap(long)]
trace: bool,
#[clap(long)]
Expand All @@ -26,8 +27,7 @@ struct Args {
fn main() {
let args = Args::parse();

// Constructs a subscriber whose severity level is filtered by `RUST_LOG`
fmt().with_env_filter(EnvFilter::from_default_env()).init();
tracing_subscriber::fmt().with_env_filter(args.log).init();

let code = fs::read_to_string(&args.filename).expect("Failed to read file");
let mut bf_compiler = Compiler::new(code);
Expand Down

0 comments on commit 0a4fb78

Please sign in to comment.