Skip to content

Commit

Permalink
Add test explicitly demonstrating MDC behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
morgen-peschke committed Jun 25, 2024
1 parent a808c2c commit 97ad066
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,19 @@ class Slf4jLoggerInternalSuite extends CatsEffectSuite {
)
}

testLoggerFixture().test("Slf4jLoggerInternal ignores(?) values already in the MDC") { testLogger =>
IO.delay(MDC.put("baz", "bar")) >>
Slf4jLogger.getLoggerFromSlf4j[IO](testLogger).info(Map("foo" -> "bar"))("A log went here") >>
IO(testLogger.logs())
.map(toDeferredLogs)
.assertEquals(
List(
DeferredLogMessage.info(Map("foo" -> "bar"), none, () => "A log went here")
),
clue("Context should not include baz->bar")
)
}

testLoggerFixture(
traceEnabled = false,
debugEnabled = false,
Expand Down

0 comments on commit 97ad066

Please sign in to comment.