io.tracee.contextlogger.api.WrappedContextLoggerOutput Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of contextlogger-core Show documentation
Show all versions of contextlogger-core Show documentation
Please refer to https://github.com/tracee/contextlogger.
package io.tracee.contextlogger.api;
/**
* Class for providing output at runtime via toString.
*/
public class WrappedContextLoggerOutput {
private final ContextLogger traceeContextLogger;
private String generatedOutput;
private final Object[] instancesToOutput;
private WrappedContextLoggerOutput(ContextLogger traceeContextLogger, Object... instancesToOutput) {
this.traceeContextLogger = traceeContextLogger;
this.instancesToOutput = instancesToOutput;
}
@Override
public String toString() {
if (generatedOutput == null) {
generatedOutput = (traceeContextLogger != null ? traceeContextLogger.toString(instancesToOutput) : null);
}
return generatedOutput;
}
public static WrappedContextLoggerOutput wrap(ContextLogger traceeContextLogger, Object... instancesToOutput) {
return new WrappedContextLoggerOutput(traceeContextLogger, instancesToOutput);
}
}