From: oharboe Date: Sun, 24 Feb 2008 18:46:09 +0000 (+0000) Subject: debug_level 3 now prints seconds since start of openocd X-Git-Tag: v0.1.0~959 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2fe9bf1613a892693676f391ac055efee306800f;p=openocd debug_level 3 now prints seconds since start of openocd git-svn-id: svn://svn.berlios.de/openocd/trunk@330 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- diff --git a/src/helper/log.c b/src/helper/log.c index 7b7c9144..8567c037 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -36,6 +36,7 @@ static FILE* log_output; static void *privData; static logCallback callback; +static time_t start; void log_setCallback(logCallback c, void *p) { @@ -72,7 +73,8 @@ void log_printf(enum log_levels level, const char *file, int line, const char *f if (debug_level >= LOG_DEBUG) { /* print with count and time information */ - fprintf(log_output, "%s %d %ld %s:%d %s(): %s\n", log_strings[level+1], count, time(NULL), file, line, function, buffer); + time_t t=time(NULL)-start; + fprintf(log_output, "%s %d %ld %s:%d %s(): %s\n", log_strings[level+1], count, t, file, line, function, buffer); } else { @@ -133,6 +135,7 @@ int handle_log_output_command(struct command_context_s *cmd_ctx, char *cmd, char int log_register_commands(struct command_context_s *cmd_ctx) { + start = time(NULL); register_command(cmd_ctx, NULL, "log_output", handle_log_output_command, COMMAND_ANY, "redirect logging to (default: stderr)"); register_command(cmd_ctx, NULL, "debug_level", handle_debug_level_command,