Use env var to configure logging
This commit is contained in:
parent
8a56fcf126
commit
22eba91a17
2 changed files with 9 additions and 2 deletions
|
@ -8,12 +8,15 @@ anyhow = "1.0.69"
|
||||||
parking_lot = "0.12.1"
|
parking_lot = "0.12.1"
|
||||||
poise = "0.5.2"
|
poise = "0.5.2"
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
tracing-subscriber = "0.3.16"
|
|
||||||
tracing-futures = "0.2.5"
|
tracing-futures = "0.2.5"
|
||||||
openai = "1.0.0-alpha.6"
|
openai = "1.0.0-alpha.6"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
thiserror = "1.0.39"
|
thiserror = "1.0.39"
|
||||||
|
|
||||||
|
[dependencies.tracing-subscriber]
|
||||||
|
version = "0.3.16"
|
||||||
|
features = ["fmt", "env-filter", "std"]
|
||||||
|
|
||||||
[dependencies.songbird]
|
[dependencies.songbird]
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
features = ["yt-dlp"]
|
features = ["yt-dlp"]
|
||||||
|
|
|
@ -5,6 +5,7 @@ mod personality;
|
||||||
mod queue;
|
mod queue;
|
||||||
|
|
||||||
use commands::*;
|
use commands::*;
|
||||||
|
use tracing_subscriber::{fmt, prelude::*, EnvFilter};
|
||||||
|
|
||||||
use std::{env, sync::Arc};
|
use std::{env, sync::Arc};
|
||||||
|
|
||||||
|
@ -42,7 +43,10 @@ async fn register(ctx: CommandContext<'_>) -> Result<(), Error> {
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
tracing_subscriber::fmt().init();
|
tracing_subscriber::registry()
|
||||||
|
.with(fmt::layer())
|
||||||
|
.with(EnvFilter::from_default_env())
|
||||||
|
.init();
|
||||||
|
|
||||||
let token =
|
let token =
|
||||||
env::var("DISCORD_TOKEN").expect("Expected a bot token in the environment: DISCORD_TOKEN");
|
env::var("DISCORD_TOKEN").expect("Expected a bot token in the environment: DISCORD_TOKEN");
|
||||||
|
|
Loading…
Add table
Reference in a new issue