com.testdroid.api.serialization.level.Log4jLevelSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of testdroid-api Show documentation
Show all versions of testdroid-api Show documentation
The Testdroid API library for Java
package com.testdroid.api.serialization.level;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.apache.logging.log4j.Level;
import java.io.IOException;
/**
* @author Artur Ćwikliński
*/
public class Log4jLevelSerializer extends StdSerializer {
protected Log4jLevelSerializer(Class t) {
super(t);
}
@Override
public void serialize(Level level, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
throws IOException {
jsonGenerator.writeString(level.name());
}
}