org.slf4j.spi.DefaultLoggingEventBuilder Maven / Gradle / Ivy
package org.slf4j.spi;
import java.util.function.Supplier;
import org.slf4j.Logger;
import org.slf4j.Marker;
import org.slf4j.event.DefaultLoggingEvent;
import org.slf4j.event.KeyValuePair;
import org.slf4j.event.Level;
import org.slf4j.event.LoggingEvent;
import org.slf4j.event.LoggingEventAware;
public class DefaultLoggingEventBuilder implements LoggingEventBuilder {
DefaultLoggingEvent loggingEvent;
Logger logger;
public DefaultLoggingEventBuilder(Logger logger, Level level) {
this.logger = logger;
loggingEvent = new DefaultLoggingEvent(level, logger);
}
/**
* Add a marker to the current logging event being built.
*
* It is possible to add multiple markers to the same logging event.
*
* @param marker the marker to add
*/
@Override
public LoggingEventBuilder addMarker(Marker marker) {
loggingEvent.addMarker(marker);
return this;
}
@Override
public LoggingEventBuilder setCause(Throwable t) {
loggingEvent.setThrowable(t);
return this;
}
@Override
public LoggingEventBuilder addArgument(Object p) {
loggingEvent.addArgument(p);
return this;
}
@Override
public LoggingEventBuilder addArgument(Supplier