1 package csdl.stackmvc.util; 3 4 import java.util.Date ; 5 import java.text.SimpleDateFormat ; 6 7 24 public class Debug { 25 26 private static SimpleDateFormat shortTimeFormat = 27 new SimpleDateFormat ("MM/dd HH:mm:ss"); 28 29 30 public static final String ALL = "Debug.all"; 31 32 33 public static final String STACKMVC = "Debug.StackMVC"; 34 35 36 42 public static boolean isEnabled(String category) { 43 return (System.getProperty(category) != null || System.getProperty(ALL) != null); 44 } 45 46 52 public static void println(String category, String msg) { 53 if (isEnabled(category)) { 54 System.out.println(shortTimeFormat.format(new Date ()) + " " + msg); 55 } 56 } 57 58 65 public static void println(String category, Object stuff) { 66 if (isEnabled(category)) { 67 println(category,stuff.toString()); 68 } 69 } 70 } 71 | Popular Tags |