summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormifi <mifi@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-02-14 18:30:23 +0000
committermifi <mifi@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-02-14 18:30:23 +0000
commitdf9e189efe631ab3fcdcf3350185332c1c00a6c4 (patch)
treefda9b6e5f4a6460ec76e0366c65aa395e6e4049f
parentc65f7cf2fa8f3fac1d8caba5129fb78993c21125 (diff)
downloadopenocd_libswd-df9e189efe631ab3fcdcf3350185332c1c00a6c4.tar.gz
openocd_libswd-df9e189efe631ab3fcdcf3350185332c1c00a6c4.tar.bz2
openocd_libswd-df9e189efe631ab3fcdcf3350185332c1c00a6c4.tar.xz
openocd_libswd-df9e189efe631ab3fcdcf3350185332c1c00a6c4.zip
- added patch to stop DEBUG messages to be forwarded to telnet/gdb.
(thanks to Øyvind for the patch) git-svn-id: svn://svn.berlios.de/openocd/trunk@295 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r--src/helper/log.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/helper/log.c b/src/helper/log.c
index db0bc0bd..ed0bf16d 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
+#include <time.h>
int debug_level = -1;
@@ -53,6 +54,8 @@ static char *log_strings[4] =
void log_printf(enum log_levels level, const char *file, int line, const char *function, const char *format, ...)
{
+ static int count=0;
+ count++;
va_list args;
char buffer[512];
@@ -62,19 +65,25 @@ void log_printf(enum log_levels level, const char *file, int line, const char *f
va_start(args, format);
vsnprintf(buffer, 512, format, args);
- fprintf(log_output, "%s %s:%d %s(): %s\n", log_strings[level], file, line, function, buffer);
+ char *f=strrchr(file, '/');
+ if (f!=NULL)
+ file=f+1;
+
+ fprintf(log_output, "%s %d %d %s:%d %s(): %s\n", log_strings[level], count, time(NULL), file, line, function, buffer);
fflush(log_output);
va_end(args);
- if (callback)
-{
- va_start(args, format);
+ /* Never forward LOG_DEBUG, too verbose and they can be found in the log if need be */
+ if (callback&&(level<=LOG_INFO))
+
+ {
+ va_start(args, format);
callback(privData, file, line, function, format, args);
- va_end(args);
-}
+ va_end(args);
+ }
}