def addErrorLog(content): target = AppErrorLog() target.target_url = request.url target.referer_url = request.referrer target.query_params = json.dumps(request.values.to_dict()) target.content = content target.created_time = getCurrentDate() db.session.add(target) db.session.commit() return True
def add_error_log(content): if 'favicon.ico' in request.url: return target = AppErrorLog() target.target_url = request.url target.referer_url = request.referrer target.query_params = json.dumps(request.values.to_dict()) target.content = content target.created_time = get_current_date() db.session.add(target) db.session.commit() return True
def addErrorLog(content): # content 是错误拦截器传回的e """ 错误记录 """ target = AppErrorLog() target.target_url = request.url # 请求的链接 target.referer_url = request.referrer target.ip = request.remote_addr # 远程地址 target.query_params = json.dumps(request.values.to_dict( )) # 使用json的方式传进来。dumps将字符串解析成json。to_dict():请求的数据转化成字典 target.content = content target.created_time = getCurrentData() db.session.add(target) db.session.commit() return True