summaryrefslogtreecommitdiffstats
path: root/ipsilon/util/plugin.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2015-04-21 18:19:17 -0400
committerSimo Sorce <simo@redhat.com>2015-05-07 10:44:23 -0400
commitaa5dc3b417db962a075a092d0d3528010c1059f7 (patch)
treec1f91118444bdc0d26c8bd95c8683504227b99bb /ipsilon/util/plugin.py
parent1e2cb84b570cfaa5d2de9d5830a752100cac236c (diff)
downloadipsilon.git-aa5dc3b417db962a075a092d0d3528010c1059f7.tar.gz
ipsilon.git-aa5dc3b417db962a075a092d0d3528010c1059f7.tar.xz
ipsilon.git-aa5dc3b417db962a075a092d0d3528010c1059f7.zip
Use python logging in install / log cherrypy at right severity
This replaces the print statements in the installer code with a python logger so we can log all output to the installer log and a subset of it to stdout in one step without duplication. The cherrypy.log.error() logs to the "error" log at a severity of logging.INFO by default. Set an appropriate log level for these as well. https://fedorahosted.org/ipsilon/ticket/35 Signed-off-by: Rob Crittenden <rcritten@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'ipsilon/util/plugin.py')
-rw-r--r--ipsilon/util/plugin.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/ipsilon/util/plugin.py b/ipsilon/util/plugin.py
index be6dd2f..2f9c003 100644
--- a/ipsilon/util/plugin.py
+++ b/ipsilon/util/plugin.py
@@ -19,6 +19,7 @@ import os
import imp
import cherrypy
import inspect
+import logging
from ipsilon.util.data import AdminStore
from ipsilon.util.log import Log
@@ -30,7 +31,7 @@ class Plugins(object):
def _load_class(self, tree, class_type, file_name, *pargs):
cherrypy.log.error('Check module %s for class %s' % (file_name,
- class_type))
+ class_type), severity=logging.DEBUG)
name, ext = os.path.splitext(os.path.split(file_name)[-1])
try:
if ext.lower() == '.py':
@@ -40,21 +41,24 @@ class Plugins(object):
else:
return
except Exception, e: # pylint: disable=broad-except
- cherrypy.log.error('Failed to load "%s" module: [%s]' % (name, e))
+ cherrypy.log.error('Failed to load "%s" module: [%s]' % (name, e),
+ severity=logging.ERROR)
return
if hasattr(mod, class_type):
instance = getattr(mod, class_type)(*pargs)
public_name = getattr(instance, 'name', name)
tree[public_name] = instance
- cherrypy.log.error('Added module %s as %s' % (name, public_name))
+ cherrypy.log.error('Added module %s as %s' % (name, public_name),
+ severity=logging.DEBUG)
def _load_classes(self, tree, path, class_type, *pargs):
files = None
try:
files = os.listdir(path)
except Exception, e: # pylint: disable=broad-except
- cherrypy.log.error('No modules in %s: [%s]' % (path, e))
+ cherrypy.log.error('No modules in %s: [%s]' % (path, e),
+ severity=logging.ERROR)
return
for name in files: