Belle II Software development
CprErrorMessage Class Reference

Public Member Functions

 CprErrorMessage ()
 Default constructor.
 
virtual ~CprErrorMessage ()
 Default constructor.
 
void PrintError (char *err_message, const char *file, const char *func_name, const int line)
 
void PrintError (const int shmflag, RunInfoBuffer *nsm_status, char *err_message, const char *file, const char *func_name, const int line)
 
void PrintError (const int shmflag, RunInfoBuffer *nsm_status, std::string err_str)
 
void PrintError (const char *err_message)
 

Detailed Description

Definition at line 22 of file CprErrorMessage.h.

Constructor & Destructor Documentation

◆ CprErrorMessage()

Default constructor.

Definition at line 24 of file CprErrorMessage.cc.

25{
26 openlog("", LOG_PERROR, LOG_LOCAL0);
27}

◆ ~CprErrorMessage()

~CprErrorMessage ( )
virtual

Default constructor.

Destructor

Definition at line 29 of file CprErrorMessage.cc.

30{
31 closelog();
32}

Member Function Documentation

◆ PrintError() [1/4]

void PrintError ( char *  err_message,
const char *  file,
const char *  func_name,
const int  line 
)

Definition at line 53 of file CprErrorMessage.cc.

54{
55 char err_buf[500];
56 sprintf(err_buf, "%s : %s %s %d", err_message, file, func_name, line);
57 // fprintf( stderr, "[FATAL] %s", err_message);
58 printf("%s", err_buf); fflush(stdout);
59 // B2FATAL(err_buf);
60 // printf("AL] %s\n", err_buf);
61 exit(1);
62
63// time_t current;
64// time(&current);
65// printf("\033[31m");
66// perror("[ERROR] 0: ");
67// printf("[ERROR] 1: %s", ctime(&current));
68// printf("[ERROR] 2: %s\n", err_message);
69// printf("[ERROR] 3: [file] %s [Line] %d\n", file, line);
70// printf("[ERROR] 4: [function] %s\n", func_name);
71// printf("\033[0m");
72// fflush(stdout);
73// errmsg(LOG_LOCAL0|LOG_ERR,
74// "CRITICAL : %s : init_shm() failed to get shmhead ( %p )\n",
75// __PRETTY_FUNCTION__, shmhead );
76
77 return;
78}

◆ PrintError() [2/4]

void PrintError ( const char *  err_message)

Definition at line 82 of file CprErrorMessage.cc.

83{
84 printf("[DEBUG] %s", err_message);
85 fflush(stdout);
86 // B2FATAL(err_message);
87 printf("[FATAL] %s\n", err_message); exit(1);
88
89// printf("\033[31m");
90// printf("\033[47m");
91// // B2FATAL(err_message);
92// perror("[ERROR] 0: ");
93// printf("[ERROR] 1: %s", ctime(&current));
94// printf("[ERROR] 2: %s\n", err_message);
95// printf("\033[0m");
96// printf("\033[40m");
97// fflush(stdout);
98 return;
99}

◆ PrintError() [3/4]

void PrintError ( const int  shmflag,
RunInfoBuffer nsm_status,
char *  err_message,
const char *  file,
const char *  func_name,
const int  line 
)

Definition at line 43 of file CprErrorMessage.cc.

45{
46 if (shmflag > 0) {
47 nsm_status->reportError(RunInfoBuffer::CPRFIFO_FULL);//need to implement error flag
48 }
49 PrintError(err_message, file, func_name, line);
50}

◆ PrintError() [4/4]

void PrintError ( const int  shmflag,
RunInfoBuffer nsm_status,
std::string  err_str 
)

Definition at line 35 of file CprErrorMessage.cc.

36{
37 if (shmflag > 0) {
38 nsm_status->reportError(RunInfoBuffer::CPRFIFO_FULL);//need to implement error flag
39 }
40 PrintError(err_str.c_str());
41}

The documentation for this class was generated from the following files: