Skip to content

Commit

Permalink
Merge pull request #11 from abadurczyk/add_duration
Browse files Browse the repository at this point in the history
add duration to object mapper
  • Loading branch information
dupps authored Apr 8, 2021
2 parents 7650c37 + b92a3f1 commit 7fac66e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/java/de/dm/prom/structuredlogging/MdcContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.slf4j.MDC;

import java.lang.reflect.InvocationTargetException;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
Expand Down Expand Up @@ -40,6 +41,7 @@ public final class MdcContext implements java.io.Closeable {
module.addSerializer(Period.class, new ToStringSerializer());
module.addSerializer(ZonedDateTime.class, new ToStringSerializer());
module.addSerializer(LocalTime.class, new ToStringSerializer());
module.addSerializer(Duration.class, new ToStringSerializer());

OBJECT_MAPPER.registerModule(module);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void logOverwriteLogsNothingWhenEmpty() throws Throwable {

@Test
@DisplayName("decorate decorates and does not log WARN when encountering thread without existing MDC context with JUST_OVERWRITE")
void logOverweiteDoesNotLog() throws Throwable {
void logOverwriteDoesNotLog() throws Throwable {
SpringMdcTaskDecorator mdcTaskDecorator = new SpringMdcTaskDecorator(OverwriteStrategy.JUST_OVERWRITE);

MDC.put("testKey", "testValue");
Expand Down

0 comments on commit 7fac66e

Please sign in to comment.