logger is another variable that is app-dependent. You cannot import
it. You must pass it to the functions that need it.

On Oct 17, 7:21 pm, Andrew Evans <randra...@gmail.com> wrote:
> I was following some information trying to figure out this logging system
>
> please explain how to do it with this code
>
> import logging
> from logging.handlers import SysLogHandler
>
> def _init_log():
>     logger = logging.getLogger(request.application)
>     logger.setLevel(logging.DEBUG)
>     handler = SysLogHandler(address='/dev/log')
>     handler.setLevel(logging.DEBUG)
>     handler.setFormatter(logging.Formatter('%s' % request.application +
> '[%(process)d]: %(levelname)s: %(filename)s at line %(lineno)d:
> %(message)s'))
>     logger.addHandler(handler)
>     return logger
>
> app_logging=cache.ram('once',lambda:_init_log(),time_expire=99999999)

Reply via email to