inital plugin from webtools project
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.monitor.ui / src / net / sourceforge / phpdt / monitor / ui / 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.ui.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         /**
22          * Trace constructor comment.
23          */
24         private Trace() {
25                 super();
26         }
27         
28         /**
29          * Trace the given text.
30          *
31          * @param s java.lang.String
32          */
33         public static void trace(byte level, String s) {
34                 trace(level, s, null);
35         }
36         
37         /**
38          * Trace the given message and exception.
39          *
40          * @param s java.lang.String
41          * @param t java.lang.Throwable
42          */
43         public static void trace(byte level, String s, Throwable t) {
44                 if (!MonitorUIPlugin.getInstance().isDebugging())
45                         return;
46
47                 System.out.println(s);
48                 if (t != null)
49                         t.printStackTrace();
50         }
51 }