Changes in log.c [5ebff60:0edc2fb]
Legend:
- Unmodified
- Added
- Removed
-
log.c
r5ebff60 r0edc2fb 51 51 void log_link(int level, int output) 52 52 { 53 /* I know it's ugly, but it works and I didn't feel like messing with pointer to function pointers */ 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 } 54 64 55 65 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 } 66 logoutput.informational = output_function; 65 67 } else if (level == LOGLVL_WARNING) { 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 } 68 logoutput.warning = output_function; 75 69 } else if (level == LOGLVL_ERROR) { 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 } 70 logoutput.error = output_function; 85 71 } 86 72 #ifdef DEBUG 87 73 else if (level == LOGLVL_DEBUG) { 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 } 74 logoutput.debug = output_function; 97 75 } 98 76 #endif
Note: See TracChangeset
for help on using the changeset viewer.