Add ability to disable colours in logs

This commit is contained in:
boring_nick 2024-03-01 17:24:53 +02:00
parent 0f402eabef
commit a046a381c5
1 changed files with 6 additions and 0 deletions

View File

@ -21,6 +21,7 @@ use futures::{future::try_join_all, stream::FuturesUnordered, StreamExt};
use migrator::Migrator;
use mimalloc::MiMalloc;
use std::{
env,
sync::Arc,
time::{Duration, Instant},
};
@ -46,10 +47,15 @@ static GLOBAL: MiMalloc = MiMalloc;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let use_ansi = env::var("RUST_LOG_ANSI")
.ok()
.and_then(|ansi| ansi.parse().ok())
.unwrap_or(true);
tracing_subscriber::fmt()
.with_env_filter(
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")),
)
.with_ansi(use_ansi)
.init();
let config = Config::load()?;