Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
fix: release builds not logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Sculas committed Jul 9, 2022
1 parent cee17a1 commit d69ae96
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
12 changes: 6 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand All @@ -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()
},
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit d69ae96

Please sign in to comment.