1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-26 03:04:30 +01:00

better logs

This commit is contained in:
kakwa 2015-06-20 22:40:28 +02:00
parent 719fa15c74
commit 9cda4e6de0

View File

@ -52,7 +52,7 @@ class LdapCherry(object):
) )
else: else:
cherrypy.log.error( cherrypy.log.error(
msg = "Unkwon exception <%(e)s>" % { 'e' : str(e) }, msg = "Unkwon exception '%(e)s'" % { 'e' : str(e) },
severity = logging.ERROR severity = logging.ERROR
) )
# log the traceback as 'debug' # log the traceback as 'debug'
@ -83,7 +83,7 @@ class LdapCherry(object):
for b in self.backends: for b in self.backends:
ret[b] = self.backends[b].get_groups(username) ret[b] = self.backends[b].get_groups(username)
cherrypy.log.error( cherrypy.log.error(
msg = ret, msg = "user '" + username +"' groups: " + str(ret),
severity = logging.DEBUG, severity = logging.DEBUG,
) )
return ret return ret
@ -92,13 +92,11 @@ class LdapCherry(object):
groups = self._get_groups(username) groups = self._get_groups(username)
user_roles = self.roles.get_roles(groups) user_roles = self.roles.get_roles(groups)
cherrypy.log.error( cherrypy.log.error(
msg = user_roles, msg = "user '" + username +"' roles: " + str(user_roles),
severity = logging.DEBUG, severity = logging.DEBUG,
) )
return user_roles return user_roles
def _is_admin(self, username): def _is_admin(self, username):
roles = self._get_roles(username) roles = self._get_roles(username)
return self.roles.is_admin(roles['roles']) return self.roles.is_admin(roles['roles'])
@ -156,7 +154,7 @@ 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)
@ -286,7 +284,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
@ -309,7 +307,7 @@ class LdapCherry(object):
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
) )