-/**
- * ============LICENSE_START====================================================
- * org.onap.aaf
- * ===========================================================================
- * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
- * ===========================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END====================================================
- *
- */
-
-package org.onap.aaf.misc.env;
-
-import java.io.PrintStream;
-import java.util.Date;
-
-import org.onap.aaf.misc.env.util.Chrono;
-
-/**
- * LogTarget is the interface with which to assign any kind of Logging Implementations.
- *
- * 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
- * SYSOUT: Writes messages in general form to System Out
- * SYSERR: Writes messages in general form to System Err
- *
- * @author Jonathan
- *
- */
-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));
- }
-
- };
-
-
+/**\r
+ * ============LICENSE_START====================================================\r
+ * org.onap.aaf\r
+ * ===========================================================================\r
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * ===========================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END====================================================\r
+ *\r
+ */\r
+\r
+package org.onap.aaf.misc.env;\r
+\r
+import java.io.PrintStream;\r
+import java.util.Date;\r
+\r
+import org.onap.aaf.misc.env.util.Chrono;\r
+\r
+/**\r
+ * LogTarget is the interface with which to assign any kind of Logging Implementations.\r
+ * \r
+ * Implement for any Logging Library of your choice, and for any logging string Format desired.\r
+ * \r
+ * Included are several Static Implementations for various uses:\r
+ * NULL: Does nothing with Logging Messages\r
+ * SYSOUT: Writes messages in general form to System Out\r
+ * SYSERR: Writes messages in general form to System Err\r
+ * \r
+ * @author Jonathan\r
+ *\r
+ */\r
+public interface LogTarget {\r
+ public abstract void log(Object... msgs);\r
+ public abstract void log(Throwable e, Object ... msgs);\r
+ public abstract boolean isLoggable();\r
+ public abstract void printf(String fmt, Object ... vars);\r
+\r
+ // A Convenient LogTarget to insert when a NO-OP is desired.\r
+ public static final LogTarget NULL = new LogTarget() {\r
+ public void log(Object ... msgs) {\r
+ }\r
+\r
+ public void log(Throwable t, Object ... msgs) {\r
+ }\r
+\r
+ public boolean isLoggable() {\r
+ return false;\r
+ }\r
+\r
+ @Override\r
+ public void printf(String fmt, Object ... vars) {\r
+ }\r
+ };\r
+\r
+ // A Convenient LogTarget to write to the Console\r
+ public static final LogTarget SYSOUT = new LogTarget() {\r
+ public void log(Object ... msgs) {\r
+ PrintStream out = System.out;\r
+ out.print(org.onap.aaf.misc.env.util.Chrono.dateFmt.format(new Date()));\r
+ out.print(": ");\r
+ for (Object str : msgs) {\r
+ if (str!=null) {\r
+ out.print(str.toString());\r
+ out.print(' ');\r
+ } else {\r
+ out.print("null ");\r
+ }\r
+ }\r
+ out.println();\r
+ }\r
+\r
+ public void log(Throwable t, Object ... msgs) {\r
+ PrintStream out = System.out;\r
+ out.print(Chrono.dateFmt.format(new Date()));\r
+ out.print(": ");\r
+ for (Object str : msgs) {\r
+ out.print(str.toString());\r
+ out.print(' ');\r
+ }\r
+ out.println();\r
+ t.printStackTrace(out);\r
+ out.println();\r
+ }\r
+\r
+ public boolean isLoggable() {\r
+ return true;\r
+ }\r
+\r
+ @Override\r
+ public void printf(String fmt, Object ... vars) {\r
+ log(String.format(fmt,vars));\r
+ }\r
+ };\r
+ \r
+ // A Convenient LogTarget to write to the Console\r
+ public static final LogTarget SYSERR = new LogTarget() {\r
+ public void log(Object ... msgs) {\r
+ PrintStream out = System.err;\r
+ out.print(Chrono.dateFmt.format(new Date()));\r
+ out.print(": ");\r
+ for (Object str : msgs) {\r
+ out.print(str.toString());\r
+ out.print(' ');\r
+ }\r
+ out.println();\r
+ out.flush();\r
+ }\r
+\r
+ public void log(Throwable t, Object ... msgs) {\r
+ PrintStream out = System.err;\r
+ out.print(Chrono.dateFmt.format(new Date()));\r
+ out.print(": ");\r
+ for (Object str : msgs) {\r
+ out.print(str.toString());\r
+ out.print(' ');\r
+ }\r
+ out.println();\r
+ t.printStackTrace(out);\r
+ }\r
+\r
+ public boolean isLoggable() {\r
+ return true;\r
+ }\r
+ @Override\r
+ public void printf(String fmt, Object ... vars) {\r
+ log(String.format(fmt,vars));\r
+ }\r
+\r
+ };\r
+\r
+\r
};
\ No newline at end of file