Merge "Remove "response" from yang."
[packetcable.git] / protocol_plugins.packetcable / src / main / java / org / umu / cops / common / COPSDebug.java
1 /*\r
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
5  */\r
6 package org.umu.cops.common;\r
7 \r
8 import java.io.PrintStream;\r
9 \r
10 /**\r
11  * Class to print debug and error messages.\r
12  *\r
13  * @version COPSDebug.java, v 3.00 2004\r
14  *\r
15  */\r
16 public class COPSDebug {\r
17 \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
22 \r
23     static public PrintStream _err = System.err;\r
24 \r
25     /** Prints an error message.\r
26         *\r
27         * @param          cname           Name of class that generated the error\r
28      * @param          str                Error message\r
29      *\r
30        */\r
31     public static void err (String cname, String str) {\r
32         if (_err != null)\r
33             _err.println(cname + ":" + str);\r
34     }\r
35 \r
36     /** Prints an error message.\r
37         *\r
38         * @param          cname           Name of class that generated the error\r
39      * @param          str                Error message\r
40      * @param           e                  Exception\r
41      *\r
42        */\r
43     public static void err (String cname, String str, Exception e) {\r
44         if (_err != null) {\r
45             _err.println(cname + ":" + str);\r
46             _err.println(" -Reason: " + e.getMessage());\r
47         }\r
48     }\r
49 \r
50     /** Prints an error message.\r
51         *\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
56      *\r
57        */\r
58     public static void err (String cname, String str, String extra, Exception e) {\r
59         if (_err != null) {\r
60             _err.println(cname + ":" + str);\r
61             _err.println(" -Info: " + extra);\r
62             _err.println(" -Reason: " + e.getMessage());\r
63         }\r
64     }\r
65 \r
66     /** Prints an error message.\r
67         *\r
68         * @param          cname           Name of class that generated the error\r
69      * @param          str                Error message\r
70      * @param          extra           Information\r
71      *\r
72        */\r
73     public static void err (String cname, String str, String extra) {\r
74         if (_err != null) {\r
75             _err.println(cname + ":" + str);\r
76             _err.println(" -Info: " + extra);\r
77         }\r
78     }\r
79 \r
80 }\r