01: /**
02: * $RCSfile$
03: * $Revision: $
04: * $Date: $
05: *
06: * Copyright (C) 2007 Jive Software. All rights reserved.
07: *
08: * This software is published under the terms of the GNU Public License (GPL),
09: * a copy of which is included in this distribution.
10: */package org.jivesoftware.openfire.sip.tester;
11:
12: /**
13: * Title: SIP Register Tester
14: *
15: * @author Thiago Rocha Camargo (thiago@jivesoftware.com)
16: */
17:
18: /**
19: * Creates and writes out messages.
20: */
21: public class Log {
22:
23: private static boolean debugger = false;
24:
25: static {
26: if (System.getProperty("debugger") != null
27: && System.getProperty("debugger").equals("true"))
28: Log.debugger = true;
29: }
30:
31: public static void debug(String message) {
32: if (Log.debugger)
33: System.out.println((message != null ? message : ""));
34: }
35:
36: public static void debug(String method, String message) {
37: if (Log.debugger)
38: System.out.println((method != null ? method : "") + " - "
39: + (message != null ? message : ""));
40: }
41:
42: public static void error(String method, Exception e) {
43: System.out.println((method != null ? method : "") + " - "
44: + (e != null ? e.toString() : ""));
45: }
46:
47: public static void error(Exception e) {
48: Log.error("", e);
49: }
50:
51: public static void error(String method, Error e) {
52: System.out.println((method != null ? method : "") + " - "
53: + (e != null ? e.toString() : ""));
54: }
55:
56: public static void error(String method, Throwable e) {
57: System.out.println((method != null ? method : "") + " - "
58: + (e != null ? e.toString() : ""));
59: }
60:
61: }
|