'Log the given message to the app.log or global log as appropriate.'

def __call__(self, *args, **kwargs):

    if (hasattr(request, 'app') and hasattr(request.app, 'log')):
        log = request.app.log
    else:
        log = self
    return log.error(*args, **kwargs)
