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