forked from mattroberts297/slf4s
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
136 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/test/scala/org/slf4s/LoggingWithMarkerExampleSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package org.slf4s | ||
|
||
import java.util | ||
|
||
import org.scalatest.WordSpec | ||
import org.slf4j.Marker | ||
import org.slf4j.helpers.{BasicMarker, BasicMarkerFactory} | ||
|
||
class LoggingWithMarkerExampleSpec extends WordSpec with Logging { | ||
"Trace logging with a marker should work" in { | ||
val marker: Marker = new BasicMarkerFactory().getMarker("MyMarker") | ||
log.trace(marker, "I log, therefore I am") | ||
} | ||
|
||
"Trace logging an exception with a marker should work" in { | ||
val marker: Marker = new BasicMarkerFactory().getMarker("MyMarker") | ||
val exception = new RuntimeException("foo") | ||
log.trace(marker, "I log, therefore I am", exception) | ||
} | ||
|
||
"Debug logging with a marker should work" in { | ||
val marker: Marker = new BasicMarkerFactory().getMarker("MyMarker") | ||
log.debug(marker, "I log, therefore I am") | ||
} | ||
|
||
"Debug logging an exception with a marker should work" in { | ||
val marker: Marker = new BasicMarkerFactory().getMarker("MyMarker") | ||
val exception = new RuntimeException("foo") | ||
log.debug(marker, "I log, therefore I am", exception) | ||
} | ||
|
||
"Info logging with a marker should work" in { | ||
val marker: Marker = new BasicMarkerFactory().getMarker("MyMarker") | ||
log.info(marker, "I log, therefore I am") | ||
} | ||
|
||
"Info logging an exception with a marker should work" in { | ||
val marker: Marker = new BasicMarkerFactory().getMarker("MyMarker") | ||
val exception = new RuntimeException("foo") | ||
log.info(marker, "I log, therefore I am", exception) | ||
} | ||
|
||
"Warn logging with a marker should work" in { | ||
val marker: Marker = new BasicMarkerFactory().getMarker("MyMarker") | ||
log.warn(marker, "I log, therefore I am") | ||
} | ||
|
||
"Warn logging an exception with a marker should work" in { | ||
val marker: Marker = new BasicMarkerFactory().getMarker("MyMarker") | ||
val exception = new RuntimeException("foo") | ||
log.warn(marker, "I log, therefore I am", exception) | ||
} | ||
|
||
"Error logging with a marker should work" in { | ||
val marker: Marker = new BasicMarkerFactory().getMarker("MyMarker") | ||
log.error(marker, "I log, therefore I am") | ||
} | ||
|
||
"Error logging an exception with a marker should work" in { | ||
val marker: Marker = new BasicMarkerFactory().getMarker("MyMarker") | ||
val exception = new RuntimeException("foo") | ||
log.error(marker, "I log, therefore I am", exception) | ||
} | ||
} |