1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-25 18:54:29 +01:00

better logs

This commit is contained in:
kakwa 2015-05-20 15:16:01 +02:00
parent e769aed10e
commit fc188df49e
2 changed files with 7 additions and 9 deletions

View File

@ -214,7 +214,7 @@ class LdapCherry(object):
# definition of the template directory # definition of the template directory
self.template_dir = self._get_param('resources', 'templates.dir', config) self.template_dir = self._get_param('resources', 'templates.dir', config)
cherrypy.log.error( 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 severity = logging.DEBUG
) )
# preload templates # preload templates
@ -228,33 +228,33 @@ class LdapCherry(object):
self.roles_file = self._get_param('roles', 'roles.file', config) self.roles_file = self._get_param('roles', 'roles.file', config)
cherrypy.log.error( 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 severity = logging.DEBUG
) )
self.roles = Roles(self.roles_file) self.roles = Roles(self.roles_file)
self.attributes_file = self._get_param('attributes', 'attributes.file', config) self.attributes_file = self._get_param('attributes', 'attributes.file', config)
cherrypy.log.error( 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 severity = logging.DEBUG
) )
self.attributes = Attributes(self.attributes_file) self.attributes = Attributes(self.attributes_file)
cherrypy.log.error( cherrypy.log.error(
msg = "Init directories backends", msg = "init directories backends",
severity = logging.DEBUG severity = logging.DEBUG
) )
self._init_backends(config) self._init_backends(config)
self._check_backends() self._check_backends()
cherrypy.log.error( cherrypy.log.error(
msg = "Application started", msg = "application started",
severity = logging.INFO severity = logging.INFO
) )
except Exception as e: except Exception as e:
self._handle_exception(e) self._handle_exception(e)
cherrypy.log.error( cherrypy.log.error(
msg = "Application failed to start", msg = "application failed to start",
severity = logging.ERROR severity = logging.ERROR
) )
exit(1) exit(1)

View File

@ -57,7 +57,7 @@ class MissingAttributesFile(Exception):
class BackendModuleLoadingFail(Exception): class BackendModuleLoadingFail(Exception):
def __init__(self, module): def __init__(self, module):
self.module = 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): class BackendModuleInitFail(Exception):
def __init__(self, module): def __init__(self, module):
@ -70,5 +70,3 @@ class WrongAttributeType(Exception):
self.section = section self.section = section
self.ymlfile = ymlfile self.ymlfile = ymlfile
self.log = "wrong attribute type <%(key)s> in section <%(section)s> inside file <%(ymlfile)s>" % {'key': key, 'section': section, 'ymlfile': ymlfile } self.log = "wrong attribute type <%(key)s> in section <%(section)s> inside file <%(ymlfile)s>" % {'key': key, 'section': section, 'ymlfile': ymlfile }