Skip to content

Commit a0d4e7a

Browse files
committed
Remove LoggingContext trait to slightly simplify API
1 parent e97ddd5 commit a0d4e7a

File tree

1 file changed

+8
-8
lines changed
  • plugins-Logging/src/main/scala/com/thoughtworks/deeplearning/plugins

1 file changed

+8
-8
lines changed

plugins-Logging/src/main/scala/com/thoughtworks/deeplearning/plugins/Logging.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ object Logging {
3535
private lazy val defaultMessage: String = makeDefaultMessage.toString
3636

3737
override def getMessage: String = super.getMessage match {
38-
case null => defaultMessage
38+
case null => defaultMessage
3939
case message => message
4040
}
4141
}
@@ -65,23 +65,23 @@ object Logging {
6565
trait Logging extends Layers with Weights {
6666
import Logging._
6767

68-
protected trait LoggingContext {
68+
@transient lazy val logger: Logger = Logger.getLogger(getClass.getName)
69+
70+
trait LayerApi extends super.LayerApi { this: Layer =>
6971
implicit protected def fullName: sourcecode.FullName
7072
implicit protected def methodName: sourcecode.Name
7173
implicit protected def caller: Caller[_]
72-
}
73-
74-
@transient lazy val logger: Logger = Logger.getLogger(getClass.getName)
75-
76-
trait LayerApi extends super.LayerApi with LoggingContext { this: Layer =>
7774
override protected def handleException(thrown: Throwable): Unit = {
7875
super.handleException(thrown)
7976
logger.log(new ThrownInLayer(this, thrown))
8077
}
8178
}
8279
override type Layer <: LayerApi
8380

84-
trait WeightApi extends super.WeightApi with LoggingContext { this: Weight =>
81+
trait WeightApi extends super.WeightApi { this: Weight =>
82+
implicit protected def fullName: sourcecode.FullName
83+
implicit protected def methodName: sourcecode.Name
84+
implicit protected def caller: Caller[_]
8585
override protected def handleException(thrown: Throwable): Unit = {
8686
super.handleException(thrown)
8787
logger.log(new ThrownInWeight(this, thrown))

0 commit comments

Comments
 (0)