summaryrefslogtreecommitdiff
path: root/src/helper
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2010-01-11 15:54:52 +0100
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-01-13 08:32:15 +0100
commit6c75f5249cf721aa8b8c2d774cdeeac6f9770e32 (patch)
treeaf75604c7cad8351c66f6f0cead51e5eb4d8d325 /src/helper
parentb4a4d5c7310c88ef263bfaaa060b5c249d98c446 (diff)
downloadopenocd_libswd-6c75f5249cf721aa8b8c2d774cdeeac6f9770e32.tar.gz
openocd_libswd-6c75f5249cf721aa8b8c2d774cdeeac6f9770e32.tar.bz2
openocd_libswd-6c75f5249cf721aa8b8c2d774cdeeac6f9770e32.tar.xz
openocd_libswd-6c75f5249cf721aa8b8c2d774cdeeac6f9770e32.zip
debug: make logging of commands terser
one line / command instead of one line per argument. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/command.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/helper/command.c b/src/helper/command.c
index cf66f8a4..ebd9aa62 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -108,10 +108,15 @@ static int command_retval_set(Jim_Interp *interp, int retval)
extern struct command_context *global_cmd_ctx;
+/* dump a single line to the log for the command.
+ * Do nothing in case we are not at debug level 3 */
void script_debug(Jim_Interp *interp, const char *name,
unsigned argc, Jim_Obj *const *argv)
{
- LOG_DEBUG("command - %s", name);
+ if (debug_level < LOG_LVL_DEBUG)
+ return;
+
+ char * dbg = alloc_printf("command - %s", name);
for (unsigned i = 0; i < argc; i++)
{
int len;
@@ -121,8 +126,12 @@ void script_debug(Jim_Interp *interp, const char *name,
if (*w == '#')
break;
- LOG_DEBUG("%s - argv[%d]=%s", name, i, w);
+ char * t = alloc_printf("%s %s", dbg, w);
+ free (dbg);
+ dbg = t;
}
+ LOG_DEBUG("%s", dbg);
+ free(dbg);
}
static void script_command_args_free(const char **words, unsigned nwords)