1 19 20 21 package org.netbeans.core.windows; 22 23 24 import java.util.logging.Level ; 25 import java.util.logging.Logger ; 26 27 import java.io.PrintWriter ; 28 import java.io.StringWriter ; 29 30 31 36 public abstract class Debug { 37 38 private Debug() { 39 } 40 41 42 public static boolean isLoggable(Class clazz) { 43 return Logger.getLogger(clazz.getName()).isLoggable(Level.FINE); 44 } 45 46 48 public static void log(Class clazz, String message) { 49 Logger.getLogger(clazz.getName()).fine(message); 50 } 51 52 53 public static void dumpStack(Class clazz) { 54 if(Logger.getLogger(clazz.getName()).isLoggable(Level.FINE)) { 56 StringWriter sw = new StringWriter (); 57 new Throwable ().printStackTrace(new PrintWriter (sw)); 58 log(clazz, sw.getBuffer().toString()); 59 } 60 } 61 } 62 | Popular Tags |