Skip to content

Commit ee49fc8

Browse files
prateekatknoldusanalytically
authored andcommitted
Added a method in CanLog trait to extract the context object for the logger
1 parent d149841 commit ee49fc8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/scala/com/typesafe/scalalogging/LoggerTakingImplicit.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package com.typesafe.scalalogging
33
import org.slf4j.{ Logger => Underlying }
44

55
trait CanLog[A] {
6-
def logMessage(originalMsg: String, a: A): String
7-
def afterLog(a: A): Unit = {
8-
val _ = a
6+
def logMessage(originalMsg: String, context: A): String
7+
def afterLog(context: A): Unit = {
8+
val _ = context
99
}
10+
def getContext()(implicit context: A): A = context
1011
}
1112

1213
@SerialVersionUID(957385465L)

0 commit comments

Comments
 (0)