FACT++  1.0
void dim_error_msg_handler ( int  severity,
int  error_code,
char *  msg 
)

Definition at line 1662 of file feeserver.c.

References createLogMessage(), mapDimErrorCodes(), sprintf(), and type.

Referenced by initialize().

1662  {
1663  char type[8];
1664  int eventType = 0;
1665  char message[MSG_DESCRIPTION_SIZE];
1666  int length = 0;
1667 
1668  // map severity to own log levels
1669  switch (severity) {
1670  case 0:
1671  type[sprintf(type, "INFO")] = 0;
1672  eventType = MSG_INFO;
1673  break;
1674  case 1:
1675  type[sprintf(type, "WARNING")] = 0;
1676  eventType = MSG_WARNING;
1677  break;
1678  case 2:
1679  type[sprintf(type, "ERROR")] = 0;
1680  eventType = MSG_ERROR;
1681  break;
1682  case 3:
1683  type[sprintf(type, "FATAL")] = 0;
1684  eventType = MSG_ERROR;
1685  break;
1686  default :
1687  type[sprintf(type, "UNKNOWN")] = 0;
1688  eventType = MSG_WARNING;
1689  break;
1690  }
1691 
1692 # ifdef __DEBUG
1693  // print to command line if wanted
1694  printf("DIM: [%s - %d] - %d: %s.\n", type, severity, error_code, msg);
1695  fflush(stdout);
1696 # endif
1697 
1698  // send message only if FeeServer is in serving or error state
1699  if ((state == RUNNING) || (state == ERROR_STATE)) {
1700  // put DIM error code in front of message
1701  message[sprintf(message, "%s: ", mapDimErrorCodes(error_code))] = 0;
1702  length = strlen(message);
1703  strncpy((message + length), msg, (MSG_DESCRIPTION_SIZE - length - 1));
1704  message[MSG_DESCRIPTION_SIZE - 1] = 0;
1705  // deliver message to FeeServer message system
1706  createLogMessage(eventType, message, "DIM\0");
1707  }
1708 }
static MessageStruct message
Definition: feeserver.c:101
char * mapDimErrorCodes(int errorCode)
Definition: feeserver.c:1710
void createLogMessage(unsigned int type, char *description, char *origin)
Definition: feeserver.c:1530
int type
sprintf(name1,"NewService%d", i)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: