javaee.module.common.logger.AbstractLogger Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common-javaee-module Show documentation
Show all versions of common-javaee-module Show documentation
This Module contains common JavaEE Helper Classes.
The newest version!
package javaee.module.common.logger;
public abstract class AbstractLogger {
public static void println( String message ) {
println( "", message );
}
public static void println( String level, String message ) {
println( false, level, message );
}
public static void println( boolean includeTrace, String level, String message ) {
println( true, includeTrace, level, message );
}
public static void println( boolean shouldPrint, boolean includeTrace, String level, String message ) {
if ( shouldPrint ) {
if ( includeTrace ) {
StackTraceElement[] stackTraceElements = Thread.currentThread( ).getStackTrace( );
StackTraceElement callingStackTraceElement = stackTraceElements[ 3 ];
String className = callingStackTraceElement.getClassName( );
System.out.println( level + className + " : " + message );
} else {
System.out.println( level + " : " + message );
}
}
}
}