43 lines
1.0 KiB
Java
43 lines
1.0 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.mojang.logging.LogUtils
|
|
* org.jspecify.annotations.Nullable
|
|
* org.slf4j.Logger
|
|
*/
|
|
package net.minecraft.server;
|
|
|
|
import com.mojang.logging.LogUtils;
|
|
import java.io.OutputStream;
|
|
import java.io.PrintStream;
|
|
import java.nio.charset.StandardCharsets;
|
|
import org.jspecify.annotations.Nullable;
|
|
import org.slf4j.Logger;
|
|
|
|
public class LoggedPrintStream
|
|
extends PrintStream {
|
|
private static final Logger LOGGER = LogUtils.getLogger();
|
|
protected final String name;
|
|
|
|
public LoggedPrintStream(String name, OutputStream out) {
|
|
super(out, false, StandardCharsets.UTF_8);
|
|
this.name = name;
|
|
}
|
|
|
|
@Override
|
|
public void println(@Nullable String string) {
|
|
this.logLine(string);
|
|
}
|
|
|
|
@Override
|
|
public void println(@Nullable Object object) {
|
|
this.logLine(String.valueOf(object));
|
|
}
|
|
|
|
protected void logLine(@Nullable String out) {
|
|
LOGGER.info("[{}]: {}", (Object)this.name, (Object)out);
|
|
}
|
|
}
|
|
|