From d69ae966c5643eb41408420f372c162e48ecbcf6 Mon Sep 17 00:00:00 2001 From: Lucaskyy Date: Sat, 9 Jul 2022 17:51:52 +0200 Subject: [PATCH] fix: release builds not logging --- Cargo.toml | 2 +- src/logger.rs | 6 +++++- src/main.rs | 12 ++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cedd75e..60bedaa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ serde = { version = "1.0", features = ["derive"] } dotenv = "0.15" serde_json = "1.0" tokio = { version = "1.0", features = ["rt-multi-thread"] } -log = { version = "0.4", features = ["max_level_debug", "release_max_level_warn"] } +log = { version = "0.4", features = ["max_level_debug"] } regex = "1.0" serde_regex = "1.1" chrono = "0.4" diff --git a/src/logger.rs b/src/logger.rs index a89738e..b41f455 100644 --- a/src/logger.rs +++ b/src/logger.rs @@ -11,7 +11,11 @@ pub fn init() -> anyhow::Result<()> { TerminalMode::Mixed, ColorChoice::Auto, ), - WriteLogger::new(LevelFilter::Info, Config::default(), File::create("logs.log")?), + WriteLogger::new( + LevelFilter::Info, + Config::default(), + File::create("logs.log")? + ), ])?; Ok(()) diff --git a/src/main.rs b/src/main.rs index 25f7e3b..41fe2f5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use std::{env, process}; use chrono::{DateTime, Duration, NaiveDateTime, Utc}; -use log::{error, info, trace}; +use log::{error, info, debug}; use model::application::Configuration; use regex::Regex; use serenity::client::{Context, EventHandler}; @@ -44,7 +44,7 @@ fn load_configuration() -> Configuration { #[async_trait] impl EventHandler for Handler { async fn interaction_create(&self, ctx: Context, interaction: Interaction) { - trace!("Created an interaction: {:?}", interaction); + debug!("Created an interaction: {:?}", interaction); if let Interaction::ApplicationCommand(command) = interaction { let configuration_lock = get_configuration_lock(&ctx).await; @@ -73,7 +73,7 @@ impl EventHandler for Handler { let content = if permission_granted { match command.data.name.as_str() { "reload" => { - trace!("{:?} reloaded the configuration.", command.user); + debug!("{:?} reloaded the configuration.", command.user); let new_config = load_configuration(); @@ -84,7 +84,7 @@ impl EventHandler for Handler { "Successfully reloaded configuration.".to_string() }, "stop" => { - trace!("{:?} stopped the bot.", command.user); + debug!("{:?} stopped the bot.", command.user); stop_command = true; "Stopped the bot.".to_string() }, @@ -115,7 +115,7 @@ impl EventHandler for Handler { } async fn message(&self, ctx: Context, msg: Message) { - trace!("Received message: {}", msg.content); + debug!("Received message: {}", msg.content); if msg.guild_id.is_none() || msg.author.bot { return; } @@ -185,7 +185,7 @@ impl EventHandler for Handler { async fn thread_create(&self, ctx: Context, thread: GuildChannel) { if thread.member.is_some() { - trace!("Thread was joined. Block dispatch."); + debug!("Thread was joined. Block dispatch."); return; }