From 4ea9793911147c38c594e7968abfe7a58281b22c Mon Sep 17 00:00:00 2001 From: Roberto Gritti Date: Fri, 15 Sep 2017 15:10:06 +0200 Subject: [PATCH] adding class scope to request logs --- src/main/scala/org/zalando/zhewbacca/SecurityRule.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/scala/org/zalando/zhewbacca/SecurityRule.scala b/src/main/scala/org/zalando/zhewbacca/SecurityRule.scala index 7cb5582..3f3e493 100644 --- a/src/main/scala/org/zalando/zhewbacca/SecurityRule.scala +++ b/src/main/scala/org/zalando/zhewbacca/SecurityRule.scala @@ -27,15 +27,16 @@ abstract case class ValidateTokenRule( ) extends StrictRule(method, pathRegex) { def authProvider: AuthProvider + private[this] val log = Logger(this.getClass) override def execute(nextFilter: (RequestHeader) => Future[Result], requestHeader: RequestHeader)(implicit ec: ExecutionContext): Future[Result] = RequestValidator.validate(scope, requestHeader, authProvider).flatMap[Result] { case Right(tokenInfo) => - Logger.info(s"Request #${requestHeader.id} authenticated as: ${tokenInfo.userUid}") + log.info(s"Request #${requestHeader.id} authenticated as: ${tokenInfo.userUid}") nextFilter(requestHeader.withTokenInfo(tokenInfo)) case Left(result) => - Logger.info(s"Request #${requestHeader.id} failed auth") + log.info(s"Request #${requestHeader.id} failed auth") Future.successful(result) } }