aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugin.rs
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2017-11-01 17:15:54 +0100
committerJokler <jokler.contact@gmail.com>2017-11-03 04:20:14 +0100
commit8e573c5a7a6747dd3f01c3ed97c88a3c5a57d7ec (patch)
tree041eb0efbc7e44339fe5bd1509728c4e999c477d /src/plugin.rs
parentcb07b259950d4762ceb609266cd1e8ae0ef60dad (diff)
downloadfrippy-8e573c5a7a6747dd3f01c3ed97c88a3c5a57d7ec.tar.gz
frippy-8e573c5a7a6747dd3f01c3ed97c88a3c5a57d7ec.zip
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.
Diffstat (limited to 'src/plugin.rs')
-rw-r--r--src/plugin.rs11
1 files changed, 10 insertions, 1 deletions
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);