Skip to content
Snippets Groups Projects
Commit 977cb04b authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Bumped copyright, fixed up coding style

parent 3c857ab1
No related branches found
No related tags found
No related merge requests found
# OpenTrafficShaper Plugin Handler # OpenTrafficShaper Plugin Handler
# Copyright (C) 2007-2013, AllWorldIT # Copyright (C) 2007-2014, AllWorldIT
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
...@@ -65,9 +65,9 @@ sub plugin_register ...@@ -65,9 +65,9 @@ sub plugin_register
# System plugins are in the top dir # System plugins are in the top dir
my $package; my $package;
if ($systemPlugin) { if ($systemPlugin) {
$package = "opentrafficshaper::plugins::${packageName}"; $package = sprintf("opentrafficshaper::plugins::%s",$packageName);
} else { } else {
$package = "opentrafficshaper::plugins::${packageName}::${pluginName}"; $package = sprintf("opentrafficshaper::plugins::%s::%s",$packageName,$pluginName);
} }
# Core configuration manager # Core configuration manager
...@@ -79,12 +79,12 @@ sub plugin_register ...@@ -79,12 +79,12 @@ sub plugin_register
if ($@ || (defined($res) && $res != 0)) { if ($@ || (defined($res) && $res != 0)) {
# Check if the error is critical or not # Check if the error is critical or not
if ($systemPlugin) { if ($systemPlugin) {
$logger->log(LOG_ERR,"[PLUGINS] Error loading plugin '$pluginName', things WILL BREAK! ($@)"); $logger->log(LOG_ERR,"[PLUGINS] Error loading plugin '%s', things WILL BREAK! (%s)",$pluginName,$@);
} else { } else {
$logger->log(LOG_WARN,"[PLUGINS] Error loading plugin '$pluginName' ($@)"); $logger->log(LOG_WARN,"[PLUGINS] Error loading plugin '%s' (%s)",$pluginName,$@);
} }
} else { } else {
$logger->log(LOG_DEBUG,"[PLUGINS] Plugin '$pluginName' loaded."); $logger->log(LOG_DEBUG,"[PLUGINS] Plugin '%s' loaded.",$pluginName);
} }
} }
} }
...@@ -99,11 +99,11 @@ sub init ...@@ -99,11 +99,11 @@ sub init
} }
# #
# Internal functions # Internal functions
# #
# Register plugin info # Register plugin info
sub _plugin_register { sub _plugin_register {
my ($pluginName,$pluginInfo) = @_; my ($pluginName,$pluginInfo) = @_;
...@@ -113,7 +113,7 @@ sub _plugin_register { ...@@ -113,7 +113,7 @@ sub _plugin_register {
# If no info, return # If no info, return
if (!defined($pluginInfo)) { if (!defined($pluginInfo)) {
$logger->log(LOG_WARN,"[MAIN] Plugin info not found for plugin => $pluginName"); $logger->log(LOG_WARN,"[MAIN] Plugin info not found for plugin => %s",$pluginName);
return -1; return -1;
} }
...@@ -125,7 +125,11 @@ sub _plugin_register { ...@@ -125,7 +125,11 @@ sub _plugin_register {
my $found = isPluginLoaded($require); my $found = isPluginLoaded($require);
# If still not found ERR out # If still not found ERR out
if (!$found) { if (!$found) {
$logger->log(LOG_ERR,"[MAIN] Dependency '$require' for plugin '$pluginName' NOT MET. Make sure its loaded before '$pluginName'"); $logger->log(LOG_ERR,"[MAIN] Dependency '%s' for plugin '%s' NOT MET. Make sure its loaded before '%s'",
$require,
$pluginName,
$pluginName
);
last; last;
} }
} }
...@@ -139,11 +143,13 @@ sub _plugin_register { ...@@ -139,11 +143,13 @@ sub _plugin_register {
$pluginInfo->{'Plugin'} = $pluginName; $pluginInfo->{'Plugin'} = $pluginName;
$globals->{'plugins'}->{$pluginName} = $pluginInfo; $globals->{'plugins'}->{$pluginName} = $pluginInfo;
} else { } else {
$logger->log(LOG_ERR,"[MAIN] Intialization of plugin failed => $pluginName"); $logger->log(LOG_ERR,"[MAIN] Intialization of plugin failed => %s",$pluginName);
} }
} }
return 0; return 0;
} }
1; 1;
# vim: ts=4
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment