From 3066753c69efd14f2fd388d4c79ffead6e24c21c Mon Sep 17 00:00:00 2001 From: Davide Polonio Date: Tue, 31 May 2022 13:09:31 +0200 Subject: [PATCH] feat: better logging output --- Cargo.toml | 2 +- src/main.rs | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ceab8ec..8bfef7d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "songlify" -version = "0.3.2" +version = "0.3.3" edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index e0ee163..1a8ff7c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +use log::LevelFilter; use sentry::ClientInitGuard; use std::env; use teloxide::prelude::*; @@ -15,8 +16,16 @@ static MAX_ARTISTS_CHARS: usize = 140; #[tokio::main] async fn main() { - teloxide::enable_logging!(); + if env::var("RUST_LOG").is_err() { + pretty_env_logger::formatted_builder() + .filter_module("songlify", LevelFilter::Info) + .filter_module("teloxide", LevelFilter::Info) + .init(); + } else { + pretty_env_logger::init(); + } log::info!("Starting Songlify..."); + log::trace!("You're running in trace mode!"); let mut _guard: ClientInitGuard; match env::var("SENTRY_DSN") {