Initial commit

This commit is contained in:
Isaac Parenteau
2018-09-13 21:02:36 -05:00
commit a65c54ca80
14 changed files with 1202 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
package net.locusworks.logger;
import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
@ApplicationLoggerInfo(name="System.Err", defaultLevel=LogLevel.ERROR)
public class SystemErrLogger extends PrintStream {
private ApplicationLogger logger;
public SystemErrLogger() {
this(ApplicationLoggerFactory.getLogger(SystemErrLogger.class));
}
public SystemErrLogger(ApplicationLogger logger) {
super(new ByteArrayOutputStream());
this.logger = logger;
}
@Override
public void write(byte[] b) {
logger.error(new String(b, UTF_8));
}
@Override
public void write(byte[] b, int off, int len) {
logger.error(new String(b, off, len, UTF_8));
}
@Override
public void write(int b) {
write(new byte[] { (byte)b });
}
}