first commit
This commit is contained in:
5
hrmsEjb/common/log/LoggerName.java
Normal file
5
hrmsEjb/common/log/LoggerName.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package common.log;
|
||||
|
||||
public class LoggerName {
|
||||
public static final String NAME = SimpleLogger.class.getName();
|
||||
}
|
79
hrmsEjb/common/log/SimpleLogger.java
Normal file
79
hrmsEjb/common/log/SimpleLogger.java
Normal file
@@ -0,0 +1,79 @@
|
||||
package common.log;
|
||||
|
||||
import common.Logger;
|
||||
|
||||
public class SimpleLogger extends Logger {
|
||||
private boolean suppressWarnings = false;
|
||||
|
||||
public void debug(Object message) {
|
||||
if (!this.suppressWarnings) {
|
||||
System.out.print("Debug: ");
|
||||
System.out.println(message);
|
||||
}
|
||||
}
|
||||
|
||||
public void debug(Object message, Throwable t) {
|
||||
if (!this.suppressWarnings) {
|
||||
System.out.print("Debug: ");
|
||||
System.out.println(message);
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void error(Object message) {
|
||||
System.err.print("Error: ");
|
||||
System.err.println(message);
|
||||
}
|
||||
|
||||
public void error(Object message, Throwable t) {
|
||||
System.err.print("Error: ");
|
||||
System.err.println(message);
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
||||
public void fatal(Object message) {
|
||||
System.err.print("Fatal: ");
|
||||
System.err.println(message);
|
||||
}
|
||||
|
||||
public void fatal(Object message, Throwable t) {
|
||||
System.err.print("Fatal: ");
|
||||
System.err.println(message);
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
||||
public void info(Object message) {
|
||||
if (!this.suppressWarnings)
|
||||
System.out.println(message);
|
||||
}
|
||||
|
||||
public void info(Object message, Throwable t) {
|
||||
if (!this.suppressWarnings) {
|
||||
System.out.println(message);
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void warn(Object message) {
|
||||
if (!this.suppressWarnings) {
|
||||
System.err.print("Warning: ");
|
||||
System.err.println(message);
|
||||
}
|
||||
}
|
||||
|
||||
public void warn(Object message, Throwable t) {
|
||||
if (!this.suppressWarnings) {
|
||||
System.err.print("Warning: ");
|
||||
System.err.println(message);
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected Logger getLoggerImpl(Class c) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setSuppressWarnings(boolean w) {
|
||||
this.suppressWarnings = w;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user