debug.java

来自「实现了语音聊天和文字聊天的p2p聊天工具」· Java 代码 · 共 59 行

JAVA
59
字号
package audio;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class Debug {

        public static boolean ERROR=true;
        public static boolean DEBUG=true;
        public static boolean TRACE=false;
        public static boolean TRACE_READWRITE=false;
        public static boolean TRACE_INOUT=false;
        public static boolean SHOW_ALL_EXCEPTIONS=false;

        // for net.Server
        public static boolean SLOW_NET_UPLOAD=false;
        public static boolean SLOW_NET_DOWNLOAD=false;

        // show the time of a debug message
        private static final boolean SHOW_TIMES=false;
        private static long START_TIME=System.currentTimeMillis();

        public static synchronized void println(String sMessage) {
                if (SHOW_TIMES) {
                        sMessage=""+(System.currentTimeMillis()-START_TIME)+": "+sMessage;
                }
                System.out.println(sMessage);
        }

        public static void println(Object obj, String sMessage) {
                String cn=obj.getClass().getName();
                int i=cn.lastIndexOf('.');
                if (i>=0 && i<cn.length()-1) {
                        cn=cn.substring(i+1);
                }
                println(cn+": "+sMessage);
        }

        public static synchronized void println(Throwable t) {
                t.printStackTrace();
        }

        public static synchronized void printStackTrace() {
                Thread.dumpStack();
        }
}

/*** Debug.java ***/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?