Skip to content

Commit

Permalink
feat: 🔊 add env_logger for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Jisu-Woniu committed Feb 27, 2024
1 parent ffafca6 commit aa1c882
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
31 changes: 31 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ clap = { version = "4.5.1", features = ["derive"] }
serde = { version = "1.0.197", features = ["derive"] }
tokio = { version = "1.36.0", features = ["fs", "rt-multi-thread", "macros"] }
toml = "0.8.10"
log = "0.4.20"
env_logger = "0.11.2"

# Unused for now:
# cgroups = "0.1.0"
Expand Down
13 changes: 11 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
use clap::Parser;
use env_logger::Env;
use log::{debug, info};
use tokio::fs::read;

use crate::cli::Args;
mod cli;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
env_logger::Builder::from_env(
Env::new()
.filter_or("RSJUDGE_LOG", "info")
.write_style("RSJUDGE_LOG_STYLE"),
)
.try_init()?;

let args = Args::try_parse()?;
println!("{:?}", args);
info!("{:?}", args);

let config = read(args.config_dir.join("executors.toml")).await?;

println!(
debug!(
"Config:\n{:#?}",
String::from_utf8_lossy(&config).parse::<toml::Value>()
);
Expand Down

0 comments on commit aa1c882

Please sign in to comment.