save log messages
This commit is contained in:
parent
d9e4d26b95
commit
f4e65ae7b8
1 changed files with 7 additions and 5 deletions
|
@ -95,8 +95,9 @@ def redirect_url(request, url):
|
||||||
def log(request):
|
def log(request):
|
||||||
'''
|
'''
|
||||||
param data {
|
param data {
|
||||||
type: 'ERROR', 'WARN'
|
url: url
|
||||||
message: text
|
line: line
|
||||||
|
text: text
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
status: ...
|
status: ...
|
||||||
|
@ -111,11 +112,12 @@ def log(request):
|
||||||
user = request.user
|
user = request.user
|
||||||
else:
|
else:
|
||||||
user = None
|
user = None
|
||||||
if 'message' in data:
|
if 'text' in data:
|
||||||
l = models.Log(
|
l = models.Log(
|
||||||
user=user,
|
user=user,
|
||||||
type=data.get('type', 'ERROR'),
|
text=data['text'],
|
||||||
message=data['message']
|
line=int(data.get('line', 0)),
|
||||||
|
url=data.get('url', '')
|
||||||
)
|
)
|
||||||
l.save()
|
l.save()
|
||||||
response = json_response()
|
response = json_response()
|
||||||
|
|
Loading…
Reference in a new issue