diff --git a/src/commands/owner.rs b/src/commands/owner.rs index 0a80087..9a70447 100644 --- a/src/commands/owner.rs +++ b/src/commands/owner.rs @@ -1,4 +1,3 @@ -use crate::debugln; use serenity::{ framework::standard::{ macros::{command, group}, @@ -7,6 +6,7 @@ use serenity::{ model::prelude::*, prelude::*, }; +use log::debug; use std::convert::TryFrom; #[group] @@ -26,7 +26,7 @@ pub async fn leave_guild(ctx: &Context, _msg: &Message, mut args: Args) -> Comma async fn send_message(ctx: &Context, _msg: &Message, mut args: Args) -> CommandResult { let channel_id = args.single::()?; let message = args.single::()?; - debugln!("Send {} into {:?}", message, channel_id); + debug!("Send {} into {:?}", message, channel_id); channel_id.say(ctx, message).await?; Ok(()) } diff --git a/src/macros.rs b/src/macros.rs deleted file mode 100644 index 2b77001..0000000 --- a/src/macros.rs +++ /dev/null @@ -1,8 +0,0 @@ -#[macro_export] -macro_rules! debugln { - ($($arg:tt)*) => { - if cfg!(debug_assertions) { - log::debug!($($arg)*); - } - }; -} diff --git a/src/main.rs b/src/main.rs index 181dfe8..97796ae 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,7 +38,6 @@ mod api; mod commands; mod config; mod data; -mod macros; mod presence; const PREFIX: &str = "?"; @@ -49,8 +48,8 @@ pub(crate) static mut INVITE_URL: Option = None; #[tokio::main] async fn main() -> IoResult<()> { log4rs::init_file("log4rs.yaml", Default::default()).unwrap(); - let conf: config::Conf = toml::from_str(&std::fs::read_to_string("Conf.toml")?)?; - debugln!("conf : {:?}", conf); + let conf: config::Conf = toml::from_str(&fs::read_to_string("Conf.toml")?)?; + debug!("conf : {:?}", conf); let token = conf.bot.token; @@ -66,7 +65,7 @@ async fn main() -> IoResult<()> { } } - debugln!("Log attachments : {}", unsafe { LOG_ATTACHMENTS }); + debug!("Log attachments : {}", unsafe { LOG_ATTACHMENTS }); let dir = Path::new("logging"); if !dir.exists() { @@ -91,7 +90,7 @@ async fn main() -> IoResult<()> { Err(why) => panic!("Could not access application info: {:?}", why), }; - debugln!("Owners : {:?}", owners); + debug!("Owners : {:?}", owners); let mut framework = StandardFramework::new() .configure(|c| { @@ -262,7 +261,7 @@ impl EventHandler for Messages { } async fn download_to_log(attachment: Attachment) -> commands::Result<()> { - debugln!("Download_to_log : {:?}", attachment); + debug!("Download_to_log : {:?}", attachment); let path = Path::new("logging").join(format!("{}-{}", attachment.id, attachment.filename)); let content = reqwest::get(&attachment.url).await?.bytes().await?; let mut file = File::create(path).await?; @@ -282,7 +281,7 @@ async fn normal_message(_ctx: &Context, msg: &Message) { #[hook] async fn dispatch_error(ctx: &Context, msg: &Message, error: DispatchError) { - debugln!("Dispatch error : {:?}", error); + debug!("Dispatch error : {:?}", error); match error { DispatchError::Ratelimited(seconds) => { let _ = msg