diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-11-02 22:31:17 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-11-02 22:31:17 +0100 |
commit | 75379fd60a82ff78ba5cc9368088ccb37d318d22 (patch) | |
tree | 4719cf5f58c1f3d6c9a67c55666cb0792d3465f6 /module | |
parent | Don't handle bugged event pluginConfigChanged (diff) | |
download | pyload-75379fd60a82ff78ba5cc9368088ccb37d318d22.tar.xz |
[Plugin] Improve logging
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/Plugin.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 7db733dc2..feb81b096 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -60,25 +60,30 @@ class Base(object): self.config = core.config - #log functions + def _log(self, type, args): + msg = " | ".join([str(a).strip() for a in args if a]) + logger = getattr(self.log, type) + logger("%s: %s" % (self.__name__, msg or _("%s MARK" % type.upper()))) + + def logDebug(self, *args): - self.log.debug("%s: %s" % (self.__name__, " | ".join([str(a).strip() for a in args if a]))) + return self._log("debug", args) def logInfo(self, *args): - self.log.info("%s: %s" % (self.__name__, " | ".join([str(a).strip() for a in args if a]))) + return self._log("info", args) def logWarning(self, *args): - self.log.warning("%s: %s" % (self.__name__, " | ".join([str(a).strip() for a in args if a]))) + return self._log("warning", args) def logError(self, *args): - self.log.error("%s: %s" % (self.__name__, " | ".join([str(a).strip() for a in args if a]))) + return self._log("error", args) def logCritical(self, *args): - self.log.critical("%s: %s" % (self.__name__, " | ".join([str(a).strip() for a in args if a]))) + return self._log("critical", args) def setConf(self, option, value): @@ -209,7 +214,7 @@ class Plugin(Base): self.cTask = None #captcha task self.retries = 0 # amount of retries already made - self.html = "" # some plugins store html code here + self.html = None # some plugins store html code here self.init() |