FACT++  1.0
DimErrorRedirecter.cc
Go to the documentation of this file.
1 // **************************************************************************
25 // **************************************************************************
26 #include "DimErrorRedirecter.h"
27 
28 #include <dic.hxx>
29 
30 #include "WindowLog.h"
31 #include "MessageImp.h"
32 
33 using namespace std;
34 
36 
37 // --------------------------------------------------------------------------
38 //
43 //
45 {
47  throw logic_error("ERROR - More than one instance of MyHandlers.");
48 
51 
55 }
56 
57 // --------------------------------------------------------------------------
58 //
62 //
64 {
68 }
69 
70 void DimErrorRedirecter::errorHandler(int severity, int code, char *msg)
71 {
72  static const string id = "<DIM> ";
73 
74  switch (severity)
75  {
76  case DIM_FATAL: fMsg.Fatal(id+msg); break;
77  case DIM_ERROR: fMsg.Error(id+msg); break;
78  case DIM_WARNING: fMsg.Warn(id+msg); break;
79  case DIM_INFO: fMsg.Info(id+msg); break;
80  default:
81  ostringstream str;
82  str << "DIM message with unknown severity (" << severity << "): ";
83  str << msg << " (" << code << ")";
84  fMsg.Warn(str);
85  break;
86  }
87 
88  /*
89  DIMDNSUNDEF DIM_FATAL DIM_DNS_NODE undefined
90  DIMDNSREFUS DIM_FATAL DIM_DNS refuses connection
91  DIMDNSDUPLC DIM_FATAL Service already exists in DNS
92  DIMDNSEXIT DIM_FATAL DNS requests server to EXIT
93  DIMDNSTMOUT DIM_WARNING Server failed sending Watchdog
94 
95  DIMDNSCNERR DIM_ERROR Connection to DNS failed
96  DIMDNSCNEST DIM_INFO Connection to DNS established
97 
98  DIMSVCDUPLC DIM_ERROR Service already exists in Server
99  DIMSVCFORMT DIM_ERROR Bad format string for service
100  DIMSVCINVAL DIM_ERROR Invalid Service ID
101 
102  DIMTCPRDERR DIM_ERROR TCP/IP read error
103  DIMTCPWRRTY DIM_WARNING TCP/IP write error - Retrying
104  DIMTCPWRTMO DIM_ERROR TCP/IP write error - Disconnected
105  DIMTCPLNERR DIM_ERROR TCP/IP listen error
106  DIMTCPOPERR DIM_ERROR TCP/IP open server error
107  DIMTCPCNERR DIM_ERROR TCP/IP connection error
108  DIMTCPCNEST DIM_INFO TCP/IP connection established
109  */
110 }
111 
void dis_disable_padding()
Definition: copy_swap.c:30
The base implementation of a distributed messaging system.
Definition: MessageImp.h:10
char str[80]
Definition: test_client.c:7
STL namespace.
void errorHandler(int severity, int code, char *msg)
int Error(const std::string &str)
Definition: MessageImp.h:49
int Warn(const std::string &str)
Definition: MessageImp.h:48
void addErrorHandler()
Definition: diccpp.cxx:1272
void addErrorHandler()
Definition: discpp.cxx:744
void dic_disable_padding()
Definition: copy_swap.c:25
DimErrorRedirecter(MessageImp &imp)
void addExitHandler()
Definition: discpp.cxx:738
int Info(const std::string &str)
Definition: MessageImp.h:47
int Fatal(const std::string &str)
Definition: MessageImp.h:51
static int fDimErrorRedireterCnt