X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=apps%2Fsilcd%2Fsilcd.c;h=d02d51298641cc66cc3507276e890297766f5601;hb=3749c6ee56f1df40934bab1aae6baeb334206b69;hp=cc4d7ff39ab9dc886991d8d80621ef87de15642b;hpb=7a10e386467421bfac0ba425289250e61e566ce0;p=silc.git diff --git a/apps/silcd/silcd.c b/apps/silcd/silcd.c index cc4d7ff3..d02d5129 100644 --- a/apps/silcd/silcd.c +++ b/apps/silcd/silcd.c @@ -557,6 +557,28 @@ void silc_server_stderr(SilcLogType type, char *message) } } +#ifdef SILC_DEBUG +#define NUM_DEBUGS 3000 +static char debugs[NUM_DEBUGS][128]; +static int cur_debug = 0; + +SilcBool silc_server_debug_callback(char *file, char *function, int line, + char *message, void *context) +{ + SilcTimeStruct curtime; + + /* Save the message to ring buffer */ + silc_time_value(0, &curtime); + silc_snprintf(debugs[cur_debug % NUM_DEBUGS], sizeof(debugs[0]), + "%02d:%02d:%02d %s:%d: %s", curtime.hour, + curtime.minute, curtime.second, function, line, + message); + cur_debug++; + + return FALSE; +} +#endif /* SILC_DEBUG */ + int main(int argc, char **argv) { int ret, opt, option_index; @@ -565,6 +587,10 @@ int main(int argc, char **argv) char *silcd_config_file = NULL; struct sigaction sa; +#ifdef SILC_DEBUG + silc_log_set_debug_callbacks(silc_server_debug_callback, NULL, NULL, NULL); +#endif /* SILC_DEBUG */ + /* Parse command line arguments */ if (argc > 1) { #ifdef HAVE_GETOPT_LONG