示例#1
0
文件: applog.py 项目: raowl/initpyr
    def __init__(self, status, message, **kwargs):
        """A record in the log"""
        kwargs['status'] = status
        kwargs['message'] = message

        # we need to hash down the payload if there is one
        if 'payload' in kwargs and kwargs['payload'] is not None:
            kwargs['payload'] = json.dumps(dict(kwargs.get('payload')))

        AppLogMgr.store(**kwargs)
示例#2
0
文件: applog.py 项目: mazz/kifu
    def __init__(self, status, message, **kwargs):
        """A record in the log"""
        kwargs['status'] = status
        kwargs['message'] = message

        # we need to hash down the payload if there is one
        if 'payload' in kwargs and kwargs['payload'] is not None:
            kwargs['payload'] = json.dumps(dict(kwargs.get('payload')))

        AppLogMgr.store(**kwargs)
示例#3
0
文件: api.py 项目: raowl/initpyr
def admin_applog(request):
    """Return applog data for admin use."""
    rdict = request.GET

    # Support optional filter parameters
    days = int(rdict.get('days', 1))
    status = rdict.get('status', None)
    message = rdict.get('message', None)

    log_list = AppLogMgr.find(
        days=days,
        message_filter=message,
        status=status,
    )

    ret = {
        'count': len(log_list),
        'logs': [dict(l) for l in log_list],
    }
    return _api_response(request, ret)
示例#4
0
文件: api.py 项目: mazz/kifu
def admin_applog(request):
    """Return applog data for admin use."""
    rdict = request.GET

    # Support optional filter parameters
    days = int(rdict.get('days', 1))
    status = rdict.get('status', None)
    message = rdict.get('message', None)

    log_list = AppLogMgr.find(
        days=days,
        message_filter=message,
        status=status,
    )

    ret = {
        'count': len(log_list),
        'logs': [dict(l) for l in log_list],
    }
    return _api_response(request, ret)