inital plugin from webtools project
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.monitor.core / src / net / sourceforge / phpdt / monitor / core / internal / Trace.java
1 /**********************************************************************
2  * Copyright (c) 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  *    IBM - Initial API and implementation
10  **********************************************************************/
11 package net.sourceforge.phpdt.monitor.core.internal;
12 /**
13  * Helper class to route trace output.
14  */
15 public class Trace {
16         public static byte CONFIG = 0;
17         public static byte WARNING = 1;
18         public static byte SEVERE = 2;
19         public static byte FINEST = 3;
20         
21         public static byte PARSING = 4;
22
23         /**
24          * Trace constructor comment.
25          */
26         private Trace() {
27                 super();
28         }
29         
30         /**
31          * Trace the given text.
32          *
33          * @param s java.lang.String
34          */
35         public static void trace(byte level, String s) {
36                 trace(level, s, null);
37         }
38         
39         /**
40          * Trace the given message and exception.
41          *
42          * @param s java.lang.String
43          * @param t java.lang.Throwable
44          */
45         public static void trace(byte level, String s, Throwable t) {
46                 if (!MonitorPlugin.getInstance().isDebugging())
47                         return;
48
49                 System.out.println(s);
50                 if (t != null)
51                         t.printStackTrace();
52         }
53 }