DB.java
1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package is2.util;
import java.util.Calendar;
import java.util.GregorianCalendar;
public class DB {
private static final String ARROW = " -> ";
private static final String LEER = " ";
private static final String BIG = " ";
private static boolean debug = true;
final static public void println(Object err) {
if (!debug)
return;
StackTraceElement[] ste = new Exception().getStackTrace();
StringBuffer msg = new StringBuffer();
msg.append((getDate().append(LEER).substring(0, 10)));
msg.append(' ');
msg.append(ste[1].getClassName() + " " + ste[1].getLineNumber());
msg.append(':');
msg.append(ste[1].getMethodName());
msg.append(ARROW);
int l = 55 - msg.length();
if (l < 0)
l = 0;
msg.append(BIG.substring(0, l));
// if ((m_depth >= 0) && (m_depth < (BIG.length()) )) {
// vDebugMessage.append(BIG.substring(0, m_depth*2));
// }
msg.append(err);
System.err.println(msg);
}
final static public void prints(Object err) {
if (!debug)
return;
System.err.println(err);
}
final private static StringBuffer getDate() {
// if (Preferences.s_debug <= BDebug.FAIL) return s_sb;
GregorianCalendar s_cal = new GregorianCalendar();
StringBuffer sb = new StringBuffer();
// sb.append(s_cal.get(Calendar.HOUR_OF_DAY));
// sb.append('_');
sb.append(s_cal.get(Calendar.MINUTE));
sb.append('.');
sb.append(s_cal.get(Calendar.SECOND));
sb.append('.');
sb.append(s_cal.get(Calendar.MILLISECOND));
return sb;
}
public static void setDebug(boolean b) {
debug = b;
}
public static boolean getDebug() {
return debug;
}
}