web: log response when >= http 400
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
		| @ -7,7 +7,16 @@ export class LoggingMiddleware implements Middleware { | ||||
|  | ||||
|     post(context: ResponseContext): Promise<Response | void> { | ||||
|         tenant().then(tenant => { | ||||
|             console.debug(`authentik/api[${tenant.matchedDomain}]: ${context.response.status} ${context.init.method} ${context.url}`); | ||||
|             let msg = `authentik/api[${tenant.matchedDomain}]: `; | ||||
|             msg += `${context.response.status} ${context.init.method} ${context.url}`; | ||||
|             if (context.response.status >= 400) { | ||||
|                 context.response.text().then(t => { | ||||
|                     msg += ` => ${t}`; | ||||
|                     console.debug(msg); | ||||
|                 }); | ||||
|             } else { | ||||
|                 console.debug(msg); | ||||
|             } | ||||
|         }); | ||||
|         return Promise.resolve(context.response); | ||||
|     } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jens Langhammer
					Jens Langhammer