Use env var to configure logging

This commit is contained in:
Alex Page 2023-03-18 01:06:50 -04:00
parent 8a56fcf126
commit 22eba91a17
2 changed files with 9 additions and 2 deletions

View file

@ -5,6 +5,7 @@ mod personality;
mod queue;
use commands::*;
use tracing_subscriber::{fmt, prelude::*, EnvFilter};
use std::{env, sync::Arc};
@ -42,7 +43,10 @@ async fn register(ctx: CommandContext<'_>) -> Result<(), Error> {
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt().init();
tracing_subscriber::registry()
.with(fmt::layer())
.with(EnvFilter::from_default_env())
.init();
let token =
env::var("DISCORD_TOKEN").expect("Expected a bot token in the environment: DISCORD_TOKEN");