Changes in log.c [0edc2fb:5ebff60]
Legend:
- Unmodified
- Added
- Removed
-
log.c
r0edc2fb r5ebff60 51 51 void log_link(int level, int output) 52 52 { 53 void (*output_function)(int level, const char *logmessage) = &log_null; 54 55 if (output == LOGOUTPUT_NULL) { 56 output_function = &log_null; 57 } else if (output == LOGOUTPUT_IRC) { 58 output_function = &log_irc; 59 } else if (output == LOGOUTPUT_SYSLOG) { 60 output_function = &log_syslog; 61 } else if (output == LOGOUTPUT_CONSOLE) { 62 output_function = &log_console; 63 } 64 65 if (level == LOGLVL_INFO) { 66 logoutput.informational = output_function; 53 /* I know it's ugly, but it works and I didn't feel like messing with pointer to function pointers */ 54 55 if (level == LOGLVL_INFO) { 56 if (output == LOGOUTPUT_NULL) { 57 logoutput.informational = &log_null; 58 } else if (output == LOGOUTPUT_IRC) { 59 logoutput.informational = &log_irc; 60 } else if (output == LOGOUTPUT_SYSLOG) { 61 logoutput.informational = &log_syslog; 62 } else if (output == LOGOUTPUT_CONSOLE) { 63 logoutput.informational = &log_console; 64 } 67 65 } else if (level == LOGLVL_WARNING) { 68 logoutput.warning = output_function; 66 if (output == LOGOUTPUT_NULL) { 67 logoutput.warning = &log_null; 68 } else if (output == LOGOUTPUT_IRC) { 69 logoutput.warning = &log_irc; 70 } else if (output == LOGOUTPUT_SYSLOG) { 71 logoutput.warning = &log_syslog; 72 } else if (output == LOGOUTPUT_CONSOLE) { 73 logoutput.warning = &log_console; 74 } 69 75 } else if (level == LOGLVL_ERROR) { 70 logoutput.error = output_function; 76 if (output == LOGOUTPUT_NULL) { 77 logoutput.error = &log_null; 78 } else if (output == LOGOUTPUT_IRC) { 79 logoutput.error = &log_irc; 80 } else if (output == LOGOUTPUT_SYSLOG) { 81 logoutput.error = &log_syslog; 82 } else if (output == LOGOUTPUT_CONSOLE) { 83 logoutput.error = &log_console; 84 } 71 85 } 72 86 #ifdef DEBUG 73 87 else if (level == LOGLVL_DEBUG) { 74 logoutput.debug = output_function; 88 if (output == LOGOUTPUT_NULL) { 89 logoutput.debug = &log_null; 90 } else if (output == LOGOUTPUT_IRC) { 91 logoutput.debug = &log_irc; 92 } else if (output == LOGOUTPUT_SYSLOG) { 93 logoutput.debug = &log_syslog; 94 } else if (output == LOGOUTPUT_CONSOLE) { 95 logoutput.debug = &log_console; 96 } 75 97 } 76 98 #endif
Note: See TracChangeset
for help on using the changeset viewer.