ai.timefold.solver.python.logging.PythonDelegateAppender Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of timefold-solver-python-core Show documentation
Show all versions of timefold-solver-python-core Show documentation
Timefold solves planning problems.
This lightweight, embeddable planning engine implements powerful and scalable algorithms
to optimize business resource scheduling and planning.
This module contains the core implementation of the Python solver.
package ai.timefold.solver.python.logging;
import java.util.function.Consumer;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.AppenderBase;
public class PythonDelegateAppender extends AppenderBase {
private static Consumer logEventConsumer;
public static void setLogEventConsumer(Consumer logEventConsumer) {
PythonDelegateAppender.logEventConsumer = logEventConsumer;
}
@Override
protected void append(ILoggingEvent eventObject) {
logEventConsumer.accept(
new PythonLoggingEvent(
PythonLogLevel.fromJavaLevel(eventObject.getLevel()),
eventObject.getFormattedMessage()));
}
}