Improve logging
This commit is contained in:
parent
e53a1d594f
commit
2dece4c576
|
@ -62,21 +62,21 @@ function enforce_legacy(r) {
|
|||
error(context, "[PEP] Unathorized context " + response.result.context)
|
||||
throw new Error("Unauthorized")
|
||||
}
|
||||
log(context, "Authorization successful")
|
||||
log(context, "Authorization successful for " + response.result.username + " in " + response.result.context)
|
||||
return response
|
||||
} else {
|
||||
error(context, "[Social Service] failed " + reply.status + ":" + reply.responseText)
|
||||
throw new Error("Unauthorized")
|
||||
}
|
||||
}).then(userinfo => {
|
||||
debug(context, "[Social Service] username is " + userinfo.result.username)
|
||||
debug(context, "Authorizated user: " + userinfo.result.username)
|
||||
// debug(context, "Context again:\n" + njs.dump(context));
|
||||
context.userinfo = userinfo
|
||||
context.record = buildAccountingRecord_legacy(context)
|
||||
return context.request.subrequest("/_backend", { method: context.request.method, args: JSON.stringify(context.request.args), headers: context.request.headersIn })
|
||||
}).then(reply => {
|
||||
debug(context, "response from backend\n" + reply.responseText);
|
||||
debug(context, "response status: " + reply.status)
|
||||
// debug(context, "response from backend\n" + reply.responseText);
|
||||
debug(context, "Response status from backend: " + reply.status)
|
||||
copyHeaders(context, reply.headersOut, r.headersOut)
|
||||
closeAccountingRecord_legacy(context.record, (reply.status === 200 || reply.status === 201 || reply.status === 204))
|
||||
context.request.subrequest("/_accounting_legacy", { detached: true, body: JSON.stringify([context.record]) })
|
||||
|
|
Loading…
Reference in New Issue