dfilter: Remove unnecessary log activation check
Use log_write_always_full() instead of ws_log() to avoid a useless activation check. Rename stnode_log() to log_stnode() for consistency.
This commit is contained in:
parent
728061fa17
commit
487e2b6bc3
|
@ -432,7 +432,7 @@ check_exists(dfwork_t *dfw, stnode_t *st_arg1)
|
|||
#endif
|
||||
|
||||
ws_debug("4 check_exists() [%u]", i++);
|
||||
stnode_log(st_arg1);
|
||||
log_stnode(st_arg1);
|
||||
|
||||
switch (stnode_type_id(st_arg1)) {
|
||||
case STTYPE_FIELD:
|
||||
|
@ -1413,8 +1413,8 @@ check_relation(dfwork_t *dfw, const char *relation_string,
|
|||
char *s;
|
||||
|
||||
ws_debug("4 check_relation(\"%s\") [%u]", relation_string, i++);
|
||||
stnode_log(st_arg1);
|
||||
stnode_log(st_arg2);
|
||||
log_stnode(st_arg1);
|
||||
log_stnode(st_arg2);
|
||||
|
||||
/* Protocol can only be on LHS (for "contains" or "matches" operators).
|
||||
* Check to see if protocol is on RHS, and re-interpret it as UNPARSED
|
||||
|
@ -1501,7 +1501,7 @@ check_test(dfwork_t *dfw, stnode_t *st_node)
|
|||
#endif
|
||||
|
||||
ws_debug("3 check_test(stnode_t *st_node = %p) [%u]\n", st_node, i++);
|
||||
stnode_log(st_node);
|
||||
log_stnode(st_node);
|
||||
|
||||
sttype_test_get(st_node, &st_op, &st_arg1, &st_arg2);
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ sprint_node(stnode_t *node)
|
|||
}
|
||||
|
||||
void
|
||||
stnode_log_full(enum ws_log_level level,
|
||||
log_stnode_full(enum ws_log_level level,
|
||||
const char *file, int line, const char *func,
|
||||
stnode_t *node, const char *msg)
|
||||
{
|
||||
|
@ -292,7 +292,8 @@ stnode_log_full(enum ws_log_level level,
|
|||
g_free(str);
|
||||
}
|
||||
|
||||
static void indent(wmem_strbuf_t *buf, int level)
|
||||
static void
|
||||
indent(wmem_strbuf_t *buf, int level)
|
||||
{
|
||||
for (int i = 0; i < level * 2; i++) {
|
||||
wmem_strbuf_append_c(buf, ' ');
|
||||
|
@ -346,7 +347,8 @@ log_syntax_tree(enum ws_log_level level, stnode_t *root, const char *msg)
|
|||
wmem_strbuf_t *buf = wmem_strbuf_new(NULL, NULL);
|
||||
|
||||
visit_tree(buf, root, 0);
|
||||
ws_log(LOG_DOMAIN_DFILTER, level, "%s:\n%s", msg, wmem_strbuf_get_str(buf));
|
||||
ws_log_write_always_full(LOG_DOMAIN_DFILTER, level, NULL, -1, NULL,
|
||||
"%s:\n%s", msg, wmem_strbuf_get_str(buf));
|
||||
wmem_strbuf_destroy(buf);
|
||||
}
|
||||
|
||||
|
|
|
@ -122,15 +122,15 @@ void
|
|||
stnode_set_inside_parens(stnode_t *node, gboolean inside);
|
||||
|
||||
void
|
||||
stnode_log_full(enum ws_log_level level,
|
||||
log_stnode_full(enum ws_log_level level,
|
||||
const char *file, int line, const char *func,
|
||||
stnode_t *node, const char *msg);
|
||||
|
||||
#ifdef WS_DISABLE_DEBUG
|
||||
#define stnode_log(node) (void)0;
|
||||
#define log_stnode(node) (void)0;
|
||||
#else
|
||||
#define stnode_log(node) \
|
||||
stnode_log_full(LOG_LEVEL_NOISY, __FILE__, __LINE__, __func__, node, #node)
|
||||
#define log_stnode(node) \
|
||||
log_stnode_full(LOG_LEVEL_NOISY, __FILE__, __LINE__, __func__, node, #node)
|
||||
#endif
|
||||
|
||||
void log_syntax_tree(enum ws_log_level, stnode_t *root, const char *msg);
|
||||
|
|
Loading…
Reference in New Issue