From fc188df49e7fca6d80d69613ba5459863ddf7583 Mon Sep 17 00:00:00 2001 From: kakwa Date: Wed, 20 May 2015 15:16:01 +0200 Subject: [PATCH] better logs --- ldapcherry/__init__.py | 12 ++++++------ ldapcherry/exceptions.py | 4 +--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ldapcherry/__init__.py b/ldapcherry/__init__.py index 04d74b3..fe6a98d 100644 --- a/ldapcherry/__init__.py +++ b/ldapcherry/__init__.py @@ -214,7 +214,7 @@ class LdapCherry(object): # definition of the template directory self.template_dir = self._get_param('resources', 'templates.dir', config) cherrypy.log.error( - msg = "Loading templates from dir <%(dir)s>" % { 'dir': self.template_dir }, + msg = "loading templates from dir <%(dir)s>" % { 'dir': self.template_dir }, severity = logging.DEBUG ) # preload templates @@ -228,33 +228,33 @@ class LdapCherry(object): self.roles_file = self._get_param('roles', 'roles.file', config) cherrypy.log.error( - msg = "Loading roles file <%(file)s>" % { 'file': self.roles_file }, + msg = "loading roles file <%(file)s>" % { 'file': self.roles_file }, severity = logging.DEBUG ) self.roles = Roles(self.roles_file) self.attributes_file = self._get_param('attributes', 'attributes.file', config) cherrypy.log.error( - msg = "Loading attributes file <%(file)s>" % { 'file': self.attributes_file }, + msg = "loading attributes file <%(file)s>" % { 'file': self.attributes_file }, severity = logging.DEBUG ) self.attributes = Attributes(self.attributes_file) cherrypy.log.error( - msg = "Init directories backends", + msg = "init directories backends", severity = logging.DEBUG ) self._init_backends(config) self._check_backends() cherrypy.log.error( - msg = "Application started", + msg = "application started", severity = logging.INFO ) except Exception as e: self._handle_exception(e) cherrypy.log.error( - msg = "Application failed to start", + msg = "application failed to start", severity = logging.ERROR ) exit(1) diff --git a/ldapcherry/exceptions.py b/ldapcherry/exceptions.py index 07f9d6d..a69c59d 100644 --- a/ldapcherry/exceptions.py +++ b/ldapcherry/exceptions.py @@ -57,7 +57,7 @@ class MissingAttributesFile(Exception): class BackendModuleLoadingFail(Exception): def __init__(self, module): self.module = module - self.log = "fail to load module <%(module)s>" % {'module': module} + self.log = "module <%(module)s> not in python path" % {'module': module} class BackendModuleInitFail(Exception): def __init__(self, module): @@ -70,5 +70,3 @@ class WrongAttributeType(Exception): self.section = section self.ymlfile = ymlfile self.log = "wrong attribute type <%(key)s> in section <%(section)s> inside file <%(ymlfile)s>" % {'key': key, 'section': section, 'ymlfile': ymlfile } - -