01: package simpleorm.simplewebapp.core;
02:
03: /**
04: * Very lightweight logger. Speicalize as needed.
05: * (Logs to System.err instead of System.out to maintain correct order if exceptions thrown.)
06: */
07: public class WLog {
08: static int pageCount = 0;
09: int pageNr;
10: long start = System.currentTimeMillis();
11:
12: public WLog() {
13: synchronized (WLog.class) {
14: pageNr = ++pageCount;
15: }
16: }
17:
18: /** Messages normally left on in production */
19: public void info(String msg) {
20: System.err.println(pageNr + "=== " + msg);
21: }
22:
23: /** Messages normally left off in production */
24: public void debug(String msg) {
25: if (isDebug())
26: System.err.println(pageNr + "== " + msg);
27: }
28:
29: public boolean isDebug() {
30: return true;
31: }
32:
33: public long time() {
34: return System.currentTimeMillis() - start;
35: }
36: ///////// generated /////////////
37: }
|