2 * Copyright (c) 2004 University of Murcia. All rights reserved.
\r
3 * --------------------------------------------------------------
\r
4 * For more information, please see <http://www.umu.euro6ix.org/>.
\r
6 package org.umu.cops.common;
\r
8 import java.io.PrintStream;
\r
11 * Class to print debug and error messages.
\r
13 * @version COPSDebug.java, v 3.00 2004
\r
16 public class COPSDebug {
\r
18 static public final String ERROR_NOEXPECTEDMSG = "Message not expected";
\r
19 static public final String ERROR_EXCEPTION = "Exception not expected";
\r
20 static public final String ERROR_SOCKET = "Error socket";
\r
21 static public final String ERROR_NOSUPPORTED = "Object not supported";
\r
23 static public PrintStream _err = System.err;
\r
25 /** Prints an error message.
\r
27 * @param cname Name of class that generated the error
\r
28 * @param str Error message
\r
31 public static void err (String cname, String str) {
\r
33 _err.println(cname + ":" + str);
\r
36 /** Prints an error message.
\r
38 * @param cname Name of class that generated the error
\r
39 * @param str Error message
\r
40 * @param e Exception
\r
43 public static void err (String cname, String str, Exception e) {
\r
45 _err.println(cname + ":" + str);
\r
46 _err.println(" -Reason: " + e.getMessage());
\r
50 /** Prints an error message.
\r
52 * @param cname Name of class that generated the error
\r
53 * @param str Error message
\r
54 * @param extra Information
\r
55 * @param e Exception
\r
58 public static void err (String cname, String str, String extra, Exception e) {
\r
60 _err.println(cname + ":" + str);
\r
61 _err.println(" -Info: " + extra);
\r
62 _err.println(" -Reason: " + e.getMessage());
\r
66 /** Prints an error message.
\r
68 * @param cname Name of class that generated the error
\r
69 * @param str Error message
\r
70 * @param extra Information
\r
73 public static void err (String cname, String str, String extra) {
\r
75 _err.println(cname + ":" + str);
\r
76 _err.println(" -Info: " + extra);
\r