void warning(int err, const char *fmt, ...) { int e; if ((e = thread_to[thread_slot()])) { FUNCTION_GUTS_EXCL(GW_WARNING, ""); } else { FUNCTION_GUTS(GW_WARNING, ""); } }
void info(int err, const char *fmt, ...) { int e; if ((e = thread_to[thread_slot()])) { FUNCTION_GUTS_EXCL(GW_INFO, ""); } else { FUNCTION_GUTS(GW_INFO, ""); } }
void error(int err, const char *fmt, ...) { int e; if ((e = thread_to[thread_slot()])) { FUNCTION_GUTS_EXCL(GW_ERROR, ""); } else { FUNCTION_GUTS(GW_ERROR, ""); } }
void gw_panic(int err, const char *fmt, ...) { /* * we don't want PANICs to spread accross smsc logs, so * this will be always within the main core log. */ FUNCTION_GUTS(GW_PANIC, ""); gw_backtrace(NULL, 0, 0); #ifdef SEGFAULT_PANIC *((char*)0) = 0; #endif exit(EXIT_FAILURE); }
void debug(const char *place, int e, const char *fmt, ...) { // If we don't need output debug information. if (log_g_i_need_debug == 0) return; if (place_should_be_logged(place) && place_is_not_logged(place) == 0) { FUNCTION_GUTS(OS_DEBUG, ""); /* * Note: giving `place' to FUNCTION_GUTS makes log lines * too long and hard to follow. We'll rely on an external * list of what places are used instead of reading them * from the log file. */ } }
void debug(const char *place, int err, const char *fmt, ...) { int e; if (place_should_be_logged(place) && place_is_not_logged(place) == 0) { /* * Note: giving `place' to FUNCTION_GUTS makes log lines * too long and hard to follow. We'll rely on an external * list of what places are used instead of reading them * from the log file. */ if ((e = thread_to[thread_slot()])) { FUNCTION_GUTS_EXCL(GW_DEBUG, ""); } else { FUNCTION_GUTS(GW_DEBUG, ""); } } }
void gw_panic(int err, const char *fmt, ...) { /* * we don't want PANICs to spread accross smsc logs, so * this will be always within the main core log. */ FUNCTION_GUTS(GW_PANIC, ""); #ifdef HAVE_BACKTRACE { void *stack_frames[50]; size_t size, i; char **strings; size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*)); strings = backtrace_symbols(stack_frames, size); if (strings) { for (i = 0; i < size; i++) gw_panic_output(0, "%s", strings[i]); } else { /* hmm, no memory available */ for (i = 0; i < size; i++) gw_panic_output(0, "%p", stack_frames[i]); } /* * Note: we don't free 'strings' array because gw_free could panic's and we * have endless loop with SEGFAULT at the end. And this doesn't care * us in any case, because we are panic's and exiting immediately. (alex) */ } #endif #ifdef SEGFAULT_PANIC *((char*)0) = 0; #endif exit(EXIT_FAILURE); }
static void PRINTFLIKE(2,3) gw_panic_output(int err, const char *fmt, ...) { FUNCTION_GUTS(GW_PANIC, ""); }
void info(int e, const char *fmt, ...) { FUNCTION_GUTS(OS_INFO, ""); }
void warning(int e, const char *fmt, ...) { FUNCTION_GUTS(OS_WARNING, ""); }
void error(int e, const char *fmt, ...) { FUNCTION_GUTS(OS_ERROR, ""); }
void panic(int e, const char *fmt, ...) { FUNCTION_GUTS(OS_PANIC, ""); exit(EXIT_FAILURE); }