X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=misc%2Fenv%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fmisc%2Fenv%2FLogTarget.java;fp=misc%2Fenv%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fmisc%2Fenv%2FLogTarget.java;h=aa74edc979e8a858431b5589d413f13cb1c1ab1f;hb=4b5a7d721d994a49057e9bfb403c7bff1b376660;hp=8915becfb68f8a8efe152593534de05c02cc589b;hpb=824dc7b5fc0e1ccdf7f460479aff344727f0f01e;p=aaf%2Fauthz.git diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java b/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java index 8915becf..aa74edc9 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java @@ -32,7 +32,7 @@ import org.onap.aaf.misc.env.util.Chrono; * Implement for any Logging Library of your choice, and for any logging string Format desired. * * Included are several Static Implementations for various uses: - * NULL: Does nothing with Logging Messages + * NULL: Does nothing with Logging Messages * SYSOUT: Writes messages in general form to System Out * SYSERR: Writes messages in general form to System Err * @@ -40,103 +40,103 @@ import org.onap.aaf.misc.env.util.Chrono; * */ public interface LogTarget { - public abstract void log(Object... msgs); - public abstract void log(Throwable e, Object ... msgs); - public abstract boolean isLoggable(); - public abstract void printf(String fmt, Object ... vars); - - // A Convenient LogTarget to insert when a NO-OP is desired. - public static final LogTarget NULL = new LogTarget() { - public void log(Object ... msgs) { - } - - public void log(Throwable t, Object ... msgs) { - } - - public boolean isLoggable() { - return false; - } - - @Override - public void printf(String fmt, Object ... vars) { - } - }; - - // A Convenient LogTarget to write to the Console - public static final LogTarget SYSOUT = new LogTarget() { - public void log(Object ... msgs) { - PrintStream out = System.out; - out.print(org.onap.aaf.misc.env.util.Chrono.dateFmt.format(new Date())); - out.print(": "); - for(Object str : msgs) { - if(str!=null) { - out.print(str.toString()); - out.print(' '); - } else { - out.print("null "); - } - } - out.println(); - } - - public void log(Throwable t, Object ... msgs) { - PrintStream out = System.out; - out.print(Chrono.dateFmt.format(new Date())); - out.print(": "); - for(Object str : msgs) { - out.print(str.toString()); - out.print(' '); - } - out.println(); - t.printStackTrace(out); - out.println(); - } - - public boolean isLoggable() { - return true; - } - - @Override - public void printf(String fmt, Object ... vars) { - log(String.format(fmt,vars)); - } - }; - - // A Convenient LogTarget to write to the Console - public static final LogTarget SYSERR = new LogTarget() { - public void log(Object ... msgs) { - PrintStream out = System.err; - out.print(Chrono.dateFmt.format(new Date())); - out.print(": "); - for(Object str : msgs) { - out.print(str.toString()); - out.print(' '); - } - out.println(); - out.flush(); - } - - public void log(Throwable t, Object ... msgs) { - PrintStream out = System.err; - out.print(Chrono.dateFmt.format(new Date())); - out.print(": "); - for(Object str : msgs) { - out.print(str.toString()); - out.print(' '); - } - out.println(); - t.printStackTrace(out); - } - - public boolean isLoggable() { - return true; - } - @Override - public void printf(String fmt, Object ... vars) { - log(String.format(fmt,vars)); - } - - }; + public abstract void log(Object... msgs); + public abstract void log(Throwable e, Object ... msgs); + public abstract boolean isLoggable(); + public abstract void printf(String fmt, Object ... vars); + + // A Convenient LogTarget to insert when a NO-OP is desired. + public static final LogTarget NULL = new LogTarget() { + public void log(Object ... msgs) { + } + + public void log(Throwable t, Object ... msgs) { + } + + public boolean isLoggable() { + return false; + } + + @Override + public void printf(String fmt, Object ... vars) { + } + }; + + // A Convenient LogTarget to write to the Console + public static final LogTarget SYSOUT = new LogTarget() { + public void log(Object ... msgs) { + PrintStream out = System.out; + out.print(org.onap.aaf.misc.env.util.Chrono.dateFmt.format(new Date())); + out.print(": "); + for(Object str : msgs) { + if(str!=null) { + out.print(str.toString()); + out.print(' '); + } else { + out.print("null "); + } + } + out.println(); + } + + public void log(Throwable t, Object ... msgs) { + PrintStream out = System.out; + out.print(Chrono.dateFmt.format(new Date())); + out.print(": "); + for(Object str : msgs) { + out.print(str.toString()); + out.print(' '); + } + out.println(); + t.printStackTrace(out); + out.println(); + } + + public boolean isLoggable() { + return true; + } + + @Override + public void printf(String fmt, Object ... vars) { + log(String.format(fmt,vars)); + } + }; + + // A Convenient LogTarget to write to the Console + public static final LogTarget SYSERR = new LogTarget() { + public void log(Object ... msgs) { + PrintStream out = System.err; + out.print(Chrono.dateFmt.format(new Date())); + out.print(": "); + for(Object str : msgs) { + out.print(str.toString()); + out.print(' '); + } + out.println(); + out.flush(); + } + + public void log(Throwable t, Object ... msgs) { + PrintStream out = System.err; + out.print(Chrono.dateFmt.format(new Date())); + out.print(": "); + for(Object str : msgs) { + out.print(str.toString()); + out.print(' '); + } + out.println(); + t.printStackTrace(out); + } + + public boolean isLoggable() { + return true; + } + @Override + public void printf(String fmt, Object ... vars) { + log(String.format(fmt,vars)); + } + + }; }; \ No newline at end of file