File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ In case of `LazyLogging` and `StrictLogging`, the underlying SLF4J logger is nam
77
77
these traits are mixed:
78
78
79
79
``` scala
80
- class MyClass extends LazyLogging {
80
+ class LazyLoggingExample extends LazyLogging {
81
81
logger.debug(" This is very convenient ;-)" )
82
82
83
83
logger.whenDebugEnabled {
@@ -87,6 +87,19 @@ class MyClass extends LazyLogging {
87
87
}
88
88
```
89
89
90
+ ``` scala
91
+ class AnyLoggingExample extends AnyLogging {
92
+ override protected val logger : Logger = Logger (" name" )
93
+
94
+ logger.info(" This is Any Logging ;-)" )
95
+
96
+ logger.whenInfoEnabled {
97
+ println(" This would only execute when the info level is enabled." )
98
+ (1 to 10 ).foreach(x => println(" Scala logging is great!" ))
99
+ }
100
+ }
101
+ ```
102
+
90
103
` LoggerTakingImplicit ` provides the same methods as ` Logger ` class, but with additional implicit parameter ` A ` .
91
104
During creation of the ` LoggerTakingImplicit ` evidence ` CanLog[A] ` is required.
92
105
It may be useful when contextual parameter (e.g. _ Correlation ID_ ) is being passed around and you would like to include it in the log messages:
You can’t perform that action at this time.
0 commit comments