All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javaee.module.common.logger.AbstractLogger Maven / Gradle / Ivy

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 );
			}
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy