SyslogTErrorHandler.h File Reference

#include <stdio.h>
#include <string>
#include "TError.h"

Go to the source code of this file.

Functions

void SyslogTErrorHandler (int level, Bool_t abort, const char *location, const char *msg)

Function Documentation

void SyslogTErrorHandler ( int  level,
Bool_t  abort,
const char *  location,
const char *  msg 
)

Definition at line 23 of file SyslogTErrorHandler.cxx.

References gSystem(), DDS::kError, Nav::kInfo, and Nav::kWarning.

00025 {
00026    // This error handler function sends the messages to syslog and
00027    // if abort is set it aborts the application.
00028 
00029    if (level < gErrorIgnoreLevel)
00030       return;
00031 
00032    const char *type = 0;
00033    int priority = LOG_DEBUG;
00034    
00035    if      (level >= kInfo)
00036      { type = "Info";     priority = LOG_INFO;    }
00037    if (level >= kWarning)
00038      { type = "Warning";  priority = LOG_WARNING; }
00039    if (level >= kError)
00040      { type = "Error";    priority = LOG_ERR;     }
00041    if (level >= kSysError)
00042      { type = "SysError"; priority = LOG_CRIT;    }
00043    if (level >= kFatal)
00044      { type = "Fatal";    priority = LOG_ALERT;   }
00045 
00046    if (!location || strlen(location) == 0)
00047       syslog(priority, "<%c> %s: %s\n", type[0], type, msg);
00048    else
00049       syslog(priority, "<%c> %s in <%s>: %s\n", type[0], type, location, msg);
00050 
00051    if (abort) {
00052       syslog(priority, "<%c> aborting\n",type[0]);
00053       if (gSystem) {
00054          gSystem->StackTrace();
00055          gSystem->Abort();
00056       } else
00057          ::abort();
00058    }
00059 }


Generated on 22 Nov 2017 for loon by  doxygen 1.6.1