Skip to content

Instantly share code, notes, and snippets.

@SilverCory
Created May 22, 2015 14:05
Show Gist options
  • Save SilverCory/cd8c7f65e193264c520d to your computer and use it in GitHub Desktop.
Save SilverCory/cd8c7f65e193264c520d to your computer and use it in GitHub Desktop.
package co.ryred.util;
import lombok.Getter;
import lombok.Setter;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Created by Admin on 20/05/2015.
*/
public class LogsUtil {
@Setter
private static Logger logger = Logger.getGlobal();
@Getter
@Setter
public static boolean debug = true;
public static Logger getLogger() {
return logger == null ? (logger = Logger.getGlobal()) : logger;
}
public static boolean _D() {
return isDebug();
}
public static void _D( Object... objects ) {
//if( !isDebug() ) return;
StringBuilder sb = new StringBuilder( "[D]" );
for( Object obj : objects )
sb.append( " | " ).append( obj );
log( Level.INFO, sb );
}
public static void info( String string ) {
getLogger().info( string );
}
public static void fine( String string ) {
getLogger().fine( string );
}
public static void finer( String string ) {
getLogger().finer( string );
}
public static void finest( String string ) {
getLogger().finest( string );
}
public static void severe( String string ) {
getLogger().severe( string );
}
public static void warning( String string ) {
getLogger().warning( string );
}
public static void log( Level level, Object object ) {
getLogger().log( level, object.toString() );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment