AlcapDAQ  1
Functions | Variables
diag.h File Reference
#include <stdarg.h>

Go to the source code of this file.

Functions

void diag_print_setup ()
 
void diag_print_impl (int level, char *format, va_list ap)
 
void diag_print (int level, char *format,...)
 

Variables

int diag_print_threshold
 
int diag_cm_msg_threshold
 

Function Documentation

void diag_print ( int  level,
char *  format,
  ... 
)
inline
void diag_print_impl ( int  level,
char *  format,
va_list  ap 
)

Definition at line 35 of file diag.cpp.

36 {
37  // Format the message.
38  char buffer[4096];
39  vsnprintf(buffer, sizeof(buffer), format, argp);
40 
41  // Print on standard output
42  // if (level <= diag_print_threshold) {
43  printf("%s", buffer);
44  fflush(stdout);
45  // }
46 
47  // Send to cm_msg
48  if(level <= diag_cm_msg_threshold) {
49 
50  // Be careful to avoid sending too many messages...let's limit ourselves
51  // to 10 per second.
52 
53  time_t now = time(NULL);
54  if(last_message_time == now) {
56  if(num_messages_this_second < 1) {
57  cm_msg(MINFO, frontend_name, buffer);
58  }
59  } else {
61  }
62 
63  last_message_time = now;
64  }
65 }
void diag_print_setup ( )

Definition at line 22 of file diag.cpp.

23 {
24  // Read the diagnostic print thresholds from the ODB
26  odb_get_int("/Equipment/Crate %d/Settings/Diagnostic Print Level", crate_number);
28  odb_get_int("/Equipment/Crate %d/Settings/Operator Message Level", crate_number);
29 }

Variable Documentation

int diag_cm_msg_threshold

Definition at line 11 of file diag.cpp.

int diag_print_threshold

Definition at line 10 of file diag.cpp.