// Generated by delombok at Tue Dec 16 19:35:38 UTC 2025
package net.md_5.bungee.log;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.logging.Level;
import java.util.logging.Logger;

public class LoggingOutputStream extends ByteArrayOutputStream {
    private static final String separator = System.getProperty("line.separator");
    /*========================================================================*/
    private final Logger logger;
    private final Level level;

    @Override
    public void flush() throws IOException {
        String contents = toString(StandardCharsets.UTF_8.name());
        super.reset();
        if (!contents.isEmpty() && !contents.equals(separator)) {
            logger.logp(level, "", "", contents);
        }
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public LoggingOutputStream(final Logger logger, final Level level) {
        this.logger = logger;
        this.level = level;
    }
}
