From 2925de096370f13a14ff7cb0a574a7ec6ae99da6 Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Tue, 14 Apr 2020 16:43:54 -0400 Subject: Cleanup some warnings and stuff --- src/main/java/bjc/everge/LogStream.java | 94 ++++++++++++++++++++++++ src/main/java/bjc/everge/MirrorOutputStream.java | 12 +++ 2 files changed, 106 insertions(+) (limited to 'src/main/java/bjc') diff --git a/src/main/java/bjc/everge/LogStream.java b/src/main/java/bjc/everge/LogStream.java index 68bbf84..ef35d9b 100644 --- a/src/main/java/bjc/everge/LogStream.java +++ b/src/main/java/bjc/everge/LogStream.java @@ -164,56 +164,150 @@ public class LogStream { } } + /** + * Print a formatted message at a given verbosity level. + * + * @param lvl + * The verbosity level. + * @param msg + * The message to print. + * @param args + * The arguments to the message. + */ public void messagef(int lvl, String msg, Object... args) { if (verbosity >= lvl) { output.printf(msg, args); } } + /** + * Emit a fatal error message. + * + * @param msg + * The message to emit. + */ public void fatal(String msg) { message(FATAL, msg); } + /** + * Emit a formatted fatal error message. + * + * @param msg + * The message to emit. + * @param args + * The arguments to the message. + */ public void fatalf(String msg, Object... args) { messagef(FATAL, msg, args); } + /** + * Emit a normal error message. + * + * @param msg + * The message to emit. + */ public void error(String msg) { message(ERROR, msg); } + /** + * Emit a formatted normal error message. + * + * @param msg + * The message to emit. + * @param args + * The arguments to the message. + */ public void errorf(String msg, Object... args) { messagef(ERROR, msg, args); } + /** + * Emit a warning message. + * + * @param msg + * The message to emit. + */ public void warn(String msg) { message(WARN, msg); } + /** + * Emit a formatted warning message. + * + * @param msg + * The message to emit. + * @param args + * The arguments to the message. + */ public void warnf(String msg, Object... args) { messagef(WARN, msg, args); } + /** + * Emit an info message. + * + * @param msg + * The message to emit. + */ public void info(String msg) { message(INFO, msg); } + /** + * Emit a formatted info message. + * + * @param msg + * The message to emit. + * @param args + * The arguments to the message. + */ public void infof(String msg, Object... args) { messagef(INFO, msg, args); } + /** + * Emit a debug message. + * + * @param msg + * The message to emit. + */ public void debug(String msg) { message(DEBUG, msg); } + /** + * Emit a formatted debug message. + * + * @param msg + * The message to emit. + * @param args + * The arguments to the message. + */ public void debugf(String msg, Object... args) { messagef(DEBUG, msg, args); } + /** + * Emit a tracing message. + * + * @param msg + * The message to emit. + */ public void trace(String msg) { message(TRACE, msg); } + /** + * Emit a formatted tracing message. + * + * @param msg + * The message to emit. + * @param args + * The arguments to the message. + */ public void tracef(String msg, Object... args) { messagef(TRACE, msg, args); } diff --git a/src/main/java/bjc/everge/MirrorOutputStream.java b/src/main/java/bjc/everge/MirrorOutputStream.java index 8c99cc9..bce4f0f 100644 --- a/src/main/java/bjc/everge/MirrorOutputStream.java +++ b/src/main/java/bjc/everge/MirrorOutputStream.java @@ -3,9 +3,21 @@ package bjc.everge; import java.io.*; import java.util.*; +/** + * An output stream that mirrors its contents to other streams. + * + * @author Ben Culkin + * + */ public class MirrorOutputStream extends OutputStream { private List streams; + /** + * Create a new mirroring output stream. + * + * @param strams + * The output streams to mirror to. + */ public MirrorOutputStream(OutputStream... strams) { streams = new ArrayList<>(); -- cgit v1.2.3