-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Date serializer to mask dates in log
- Loading branch information
1 parent
ebdb788
commit d73dc04
Showing
3 changed files
with
26 additions
and
0 deletions.
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
22 changes: 22 additions & 0 deletions
22
...pring-boot-starter/src/main/java/com/tosan/http/server/starter/logger/DateSerializer.java
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,22 @@ | ||
package com.tosan.http.server.starter.logger; | ||
|
||
import com.fasterxml.jackson.core.JsonGenerator; | ||
import com.fasterxml.jackson.databind.JsonSerializer; | ||
import com.fasterxml.jackson.databind.SerializerProvider; | ||
|
||
import java.io.IOException; | ||
import java.util.Date; | ||
|
||
public class DateSerializer extends JsonSerializer<Date> { | ||
|
||
private final SerializerUtility serializerUtility; | ||
|
||
public DateSerializer(SerializerUtility serializerUtility) { | ||
this.serializerUtility = serializerUtility; | ||
} | ||
|
||
@Override | ||
public void serialize(Date value, JsonGenerator jsonGenerator, SerializerProvider serializers) throws IOException { | ||
serializerUtility.serialize(value.toString(), jsonGenerator); | ||
} | ||
} |
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