From 9e1622a679031d2bb2205ba42e23269600bc9a3a Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 25 Jan 2016 12:20:58 +0000 Subject: Wrap verbose JS logging in debug macro. --- javascript/duktape/Document.bnd | 4 ++-- javascript/duktape/Window.bnd | 2 +- javascript/duktape/dukky.c | 4 ++-- javascript/duktape/dukky.h | 6 ++++++ 4 files changed, 11 insertions(+), 5 deletions(-) (limited to 'javascript/duktape') diff --git a/javascript/duktape/Document.bnd b/javascript/duktape/Document.bnd index a51b38dfd..e15f75f48 100644 --- a/javascript/duktape/Document.bnd +++ b/javascript/duktape/Document.bnd @@ -35,7 +35,7 @@ method Document::write() } duk_concat(ctx, duk_get_top(ctx)); text = duk_safe_to_lstring(ctx, 0, &text_len); - LOG("Writing %*s", (int)text_len, text); + JS_LOG("Writing %*s", (int)text_len, text); err = dom_node_get_user_data(priv->parent.node, corestring_dom___ns_key_html_content_data, @@ -69,7 +69,7 @@ method Document::writeln() duk_concat(ctx, duk_get_top(ctx)); text = duk_safe_to_lstring(ctx, 0, &text_len); - LOG("Writeln %*s", (int)text_len, text); + JS_LOG("Writeln %*s", (int)text_len, text); err = dom_node_get_user_data(priv->parent.node, corestring_dom___ns_key_html_content_data, &htmlc); diff --git a/javascript/duktape/Window.bnd b/javascript/duktape/Window.bnd index ed931c614..81d52809a 100644 --- a/javascript/duktape/Window.bnd +++ b/javascript/duktape/Window.bnd @@ -52,7 +52,7 @@ prototype Window() getter Window::document() %{ - LOG("priv=%p", priv); + JS_LOG("priv=%p", priv); dom_document *doc = priv->htmlc->document; dukky_push_node(ctx, (struct dom_node *)doc); return 1; diff --git a/javascript/duktape/dukky.c b/javascript/duktape/dukky.c index 437a3d48a..d583484bf 100644 --- a/javascript/duktape/dukky.c +++ b/javascript/duktape/dukky.c @@ -236,7 +236,7 @@ dukky_push_node_klass(duk_context *ctx, struct dom_node *node) duk_bool_t dukky_push_node(duk_context *ctx, struct dom_node *node) { - LOG("Pushing node %p", node); + JS_LOG("Pushing node %p", node); /* First check if we can find the node */ /* ... */ duk_get_global_string(ctx, NODE_MAGIC); @@ -251,7 +251,7 @@ dukky_push_node(duk_context *ctx, struct dom_node *node) /* ... node nodes */ duk_pop(ctx); /* ... node */ - LOG("Found it memoised"); + JS_LOG("Found it memoised"); return true; } /* ... nodes undefined */ diff --git a/javascript/duktape/dukky.h b/javascript/duktape/dukky.h index d1fff36aa..212525ebe 100644 --- a/javascript/duktape/dukky.h +++ b/javascript/duktape/dukky.h @@ -24,6 +24,12 @@ #ifndef DUKKY_H #define DUKKY_H +#ifdef JS_DEBUG +# define JS_LOG(format, args...) LOG(format , ##args) +#else +# define JS_LOG(format, ...) ((void) 0) +#endif + duk_ret_t dukky_create_object(duk_context *ctx, const char *name, int args); duk_bool_t dukky_push_node_stacked(duk_context *ctx); duk_bool_t dukky_push_node(duk_context *ctx, struct dom_node *node); -- cgit v1.2.3