MyLog Class ReferenceSpecialized log for sockets library (prints with color). More...
Detailed DescriptionSpecialized log for sockets library (prints with color).File ......... MyLog.h Published .... 2004-06-01 Author ....... grymse@alhem.net
Definition at line 30 of file MyLog.h. Member Function Documentation
File ......... MyLog.cpp Published .... 2004-06-01 Author ....... grymse@alhem.net Definition at line 38 of file MyLog.cpp. References PeerHandler::dprintf(), and PeerHandler::GetDebug(). 00039 { 00040 PeerHandler& ref = static_cast<PeerHandler&>(*h); 00041 pSocket *csock = dynamic_cast<pSocket *>(sock); 00042 time_t t = time(NULL); 00043 struct tm *tp = localtime(&t); 00044 std::string level; 00045 00046 switch (lvl) 00047 { 00048 case LOG_LEVEL_WARNING: 00049 level = "Warning"; 00050 break; 00051 case LOG_LEVEL_ERROR: 00052 level = "Error"; 00053 break; 00054 case LOG_LEVEL_FATAL: 00055 level = "Fatal"; 00056 break; 00057 case LOG_LEVEL_INFO: 00058 level = "Info"; 00059 break; 00060 } 00061 00062 if (ref.GetDebug() & 2048) 00063 { 00064 std::string hname; 00065 std::string sname; 00066 if (h) 00067 hname = typeid(h).name(); 00068 if (sock) 00069 sname = typeid(sock).name(); 00070 if (csock) 00071 { 00072 ref.dprintf(csock -> GetSockId(), "%d-%02d-%02d %02d:%02d:%02d :: %s/%s; %s: %d %s (%s)", 00073 tp -> tm_year + 1900, 00074 tp -> tm_mon + 1, 00075 tp -> tm_mday, 00076 tp -> tm_hour,tp -> tm_min,tp -> tm_sec, 00077 hname.c_str(), sname.c_str(), 00078 call.c_str(),err,sys_err.c_str(),level.c_str()); 00079 } 00080 else 00081 { 00082 printf("%d-%02d-%02d %02d:%02d:%02d :: %s/%s; %s: %d %s (%s)\n", 00083 tp -> tm_year + 1900, 00084 tp -> tm_mon + 1, 00085 tp -> tm_mday, 00086 tp -> tm_hour,tp -> tm_min,tp -> tm_sec, 00087 hname.c_str(), sname.c_str(), 00088 call.c_str(),err,sys_err.c_str(),level.c_str()); 00089 } 00090 } 00091 }
The documentation for this class was generated from the following files: |