#include <stdio.h>#include <string>#include "TError.h"Go to the source code of this file.
Functions | |
| void | MsgLogTErrorHandler (int level, Bool_t abort, const char *location, const char *msg) |
|
||||||||||||||||||||
|
Definition at line 20 of file MsgLogTErrorHandler.cxx. References gSystem(), logCritical(), logError(), logNotice(), and logWarn(). Referenced by main(). 00022 {
00023 // This error handler function sends the messages to msgLog and
00024 // if abort is set it aborts the application.
00025 //
00026 // Unlike "syslog", "msgLog" levels don't quite mesh w/ ROOT's levels
00027 // ROOT msgLog msgLog function
00028 // Info Info logInfo
00029 // Notice logNotice
00030 // Warning Warning logWarn
00031 // Error Error logError
00032 // Break
00033 // SysError Critical logCritical
00034 // Fatal
00035
00036 #define LOG_I
00037
00038 if (level < gErrorIgnoreLevel) return;
00039
00040 char msgPayload[1024];
00041 if (!location || strlen(location) == 0)
00042 sprintf(msgPayload,"%s",msg);
00043 else
00044 sprintf(msgPayload,"<%s>: %s",location,msg);
00045
00046 if ( level >= kSysError ) logCritical(msgPayload);
00047 else if ( level >= kError ) logError(msgPayload);
00048 else if ( level >= kWarning ) logWarn(msgPayload);
00049 else if ( level >= kInfo ) logNotice(msgPayload); // ?logInfo?
00050
00051 if (abort) {
00052 logCritical("aborting because of \"%s\"",msgPayload);
00053 if (gSystem) {
00054 gSystem->StackTrace();
00055 gSystem->Abort();
00056 } else
00057 ::abort();
00058 }
00059 }
|
1.3.9.1