From fee12591f762b370055bd574d0db35d359dcb153 Mon Sep 17 00:00:00 2001 From: prateekatknoldus Date: Sat, 8 Jan 2022 21:17:22 +0530 Subject: [PATCH] Added a method in CanLog trait to extract the context object for the logger --- .../com/typesafe/scalalogging/LoggerTakingImplicit.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/scala/com/typesafe/scalalogging/LoggerTakingImplicit.scala b/src/main/scala/com/typesafe/scalalogging/LoggerTakingImplicit.scala index 12faaef..5f7a0a3 100644 --- a/src/main/scala/com/typesafe/scalalogging/LoggerTakingImplicit.scala +++ b/src/main/scala/com/typesafe/scalalogging/LoggerTakingImplicit.scala @@ -3,10 +3,11 @@ package com.typesafe.scalalogging import org.slf4j.{ Logger => Underlying } trait CanLog[A] { - def logMessage(originalMsg: String, a: A): String - def afterLog(a: A): Unit = { - val _ = a + def logMessage(originalMsg: String, context: A): String + def afterLog(context: A): Unit = { + val _ = context } + def getContext()(implicit context: A): A = context } @SerialVersionUID(957385465L)