mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 09:24:21 +01:00
better logs
This commit is contained in:
parent
719fa15c74
commit
9cda4e6de0
@ -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,16 +284,16 @@ 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
|
||||||
self.temp_lookup = lookup.TemplateLookup(
|
self.temp_lookup = lookup.TemplateLookup(
|
||||||
directories=self.template_dir, input_encoding='utf-8'
|
directories=self.template_dir, input_encoding='utf-8'
|
||||||
)
|
)
|
||||||
self.temp_index = self.temp_lookup.get_template('index.tmpl')
|
self.temp_index = self.temp_lookup.get_template('index.tmpl')
|
||||||
self.temp_error = self.temp_lookup.get_template('error.tmpl')
|
self.temp_error = self.temp_lookup.get_template('error.tmpl')
|
||||||
self.temp_login = self.temp_lookup.get_template('login.tmpl')
|
self.temp_login = self.temp_lookup.get_template('login.tmpl')
|
||||||
self.temp_searchadmin = self.temp_lookup.get_template('searchadmin.tmpl')
|
self.temp_searchadmin = self.temp_lookup.get_template('searchadmin.tmpl')
|
||||||
self.temp_searchuser = self.temp_lookup.get_template('searchuser.tmpl')
|
self.temp_searchuser = self.temp_lookup.get_template('searchuser.tmpl')
|
||||||
self.temp_adduser = self.temp_lookup.get_template('adduser.tmpl')
|
self.temp_adduser = self.temp_lookup.get_template('adduser.tmpl')
|
||||||
@ -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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user