From 8e573c5a7a6747dd3f01c3ed97c88a3c5a57d7ec Mon Sep 17 00:00:00 2001 From: Jokler Date: Wed, 1 Nov 2017 17:15:54 +0100 Subject: Add debug logging The log level gets set to debug or info based on the build profile automatically now. Debug messages also print their target to the console. --- src/plugin.rs | 11 ++++++++++- src/plugins/currency.rs | 1 - 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugin.rs b/src/plugin.rs index e0a4ce2..fb35668 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -98,6 +98,10 @@ impl ThreadedPlugins { // Send the message to the plugin if the plugin needs it if lock_plugin!(plugin).is_allowed(server, &message) { + debug!("Executing {} with {}", + name, + message.to_string().replace("\r\n", "")); + // Clone everything before the move // The server uses an Arc internally too let plugin = Arc::clone(&plugin); @@ -114,7 +118,10 @@ impl ThreadedPlugins { } } - pub fn handle_command(&mut self, server: &IrcServer, mut command: PluginCommand) -> Result<(), IrcError> { + pub fn handle_command(&mut self, + server: &IrcServer, + mut command: PluginCommand) + -> Result<(), IrcError> { if !command.tokens.iter().any(|s| !s.is_empty()) { let help = format!("Use \"{} help\" to get help", server.current_nickname()); @@ -127,6 +134,8 @@ impl ThreadedPlugins { // The first token contains the name of the plugin let name = command.tokens.remove(0); + debug!("Sending command \"{:?}\" to {}", command, name); + // Clone for the move - the server uses an Arc internally let server = server.clone(); let plugin = Arc::clone(plugin); diff --git a/src/plugins/currency.rs b/src/plugins/currency.rs index 78ae593..4ba2531 100644 --- a/src/plugins/currency.rs +++ b/src/plugins/currency.rs @@ -1,7 +1,6 @@ extern crate reqwest; extern crate serde; extern crate serde_json; -extern crate regex; use std::io::Read; use std::num::ParseFloatError; -- cgit v1.2.3-70-g09d2