io.quarkiverse.loggingjson.providers.ThreadIdJsonProvider Maven / Gradle / Ivy
package io.quarkiverse.loggingjson.providers;
import java.io.IOException;
import org.jboss.logmanager.ExtLogRecord;
import io.quarkiverse.loggingjson.Config;
import io.quarkiverse.loggingjson.Enabled;
import io.quarkiverse.loggingjson.JsonGenerator;
import io.quarkiverse.loggingjson.JsonProvider;
import io.quarkiverse.loggingjson.JsonWritingUtils;
public class ThreadIdJsonProvider implements JsonProvider, Enabled {
private final String fieldName;
private final Config.FieldConfig config;
public ThreadIdJsonProvider(Config.FieldConfig config) {
this.config = config;
this.fieldName = config.fieldName.orElse("threadId");
}
@Override
public void writeTo(JsonGenerator generator, ExtLogRecord event) throws IOException {
JsonWritingUtils.writeNumberField(generator, fieldName, event.getThreadID());
}
@Override
public boolean isEnabled() {
return config.enabled.orElse(true);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy