MINOR: flt_trace: Rename macros to print trace messages
Names of these macros may enter in conflict with the macros of the runtime
tracing mechanism. So the prefix "FLT_" has been added to avoid any ambiguities.
diff --git a/src/flt_trace.c b/src/flt_trace.c
index 1ef7231..5ed5158 100644
--- a/src/flt_trace.c
+++ b/src/flt_trace.c
@@ -43,12 +43,12 @@
int hexdump;
};
-#define TRACE(conf, fmt, ...) \
+#define FLT_TRACE(conf, fmt, ...) \
fprintf(stderr, "%d.%06d [%-20s] " fmt "\n", \
(int)now.tv_sec, (int)now.tv_usec, (conf)->name, \
##__VA_ARGS__)
-#define STRM_TRACE(conf, strm, fmt, ...) \
+#define FLT_STRM_TRACE(conf, strm, fmt, ...) \
fprintf(stderr, "%d.%06d [%-20s] [strm %p(%x) 0x%08x 0x%08x] " fmt "\n", \
(int)now.tv_sec, (int)now.tv_usec, (conf)->name, \
strm, (strm ? ((struct stream *)strm)->uniq_id : ~0U), \
@@ -170,7 +170,7 @@
fconf->flags |= FLT_CFG_FL_HTX;
fconf->conf = conf;
- TRACE(conf, "filter initialized [read random=%s - fwd random=%s - hexdump=%s]",
+ FLT_TRACE(conf, "filter initialized [read random=%s - fwd random=%s - hexdump=%s]",
(conf->rand_parsing ? "true" : "false"),
(conf->rand_forwarding ? "true" : "false"),
(conf->hexdump ? "true" : "false"));
@@ -184,7 +184,7 @@
struct trace_config *conf = fconf->conf;
if (conf) {
- TRACE(conf, "filter deinitialized");
+ FLT_TRACE(conf, "filter deinitialized");
free(conf->name);
free(conf);
}
@@ -205,7 +205,7 @@
{
struct trace_config *conf = fconf->conf;
- TRACE(conf, "filter initialized for thread tid %u", tid);
+ FLT_TRACE(conf, "filter initialized for thread tid %u", tid);
return 0;
}
@@ -216,7 +216,7 @@
struct trace_config *conf = fconf->conf;
if (conf)
- TRACE(conf, "filter deinitialized for thread tid %u", tid);
+ FLT_TRACE(conf, "filter deinitialized for thread tid %u", tid);
}
/**************************************************************************
@@ -228,7 +228,7 @@
{
struct trace_config *conf = FLT_CONF(filter);
- STRM_TRACE(conf, s, "%-25s: filter-type=%s",
+ FLT_STRM_TRACE(conf, s, "%-25s: filter-type=%s",
__FUNCTION__, filter_type(filter));
return 1;
@@ -241,7 +241,7 @@
{
struct trace_config *conf = FLT_CONF(filter);
- STRM_TRACE(conf, s, "%-25s: filter-type=%s",
+ FLT_STRM_TRACE(conf, s, "%-25s: filter-type=%s",
__FUNCTION__, filter_type(filter));
}
@@ -251,7 +251,7 @@
{
struct trace_config *conf = FLT_CONF(filter);
- STRM_TRACE(conf, s, "%-25s",
+ FLT_STRM_TRACE(conf, s, "%-25s",
__FUNCTION__);
return 0;
}
@@ -264,7 +264,7 @@
{
struct trace_config *conf = FLT_CONF(filter);
- STRM_TRACE(conf, s, "%-25s: backend=%s",
+ FLT_STRM_TRACE(conf, s, "%-25s: backend=%s",
__FUNCTION__, be->id);
return 0;
}
@@ -275,7 +275,7 @@
{
struct trace_config *conf = FLT_CONF(filter);
- STRM_TRACE(conf, s, "%-25s",
+ FLT_STRM_TRACE(conf, s, "%-25s",
__FUNCTION__);
}
@@ -285,7 +285,7 @@
{
struct trace_config *conf = FLT_CONF(filter);
- STRM_TRACE(conf, s, "%-25s",
+ FLT_STRM_TRACE(conf, s, "%-25s",
__FUNCTION__);
}
@@ -299,7 +299,7 @@
{
struct trace_config *conf = FLT_CONF(filter);
- STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
+ FLT_STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
__FUNCTION__,
channel_label(chn), proxy_mode(s), stream_pos(s));
filter->pre_analyzers |= (AN_REQ_ALL | AN_RES_ALL);
@@ -375,7 +375,7 @@
ana = "unknown";
}
- STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s) - "
+ FLT_STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s) - "
"analyzer=%s - step=%s",
__FUNCTION__,
channel_label(chn), proxy_mode(s), stream_pos(s),
@@ -390,7 +390,7 @@
{
struct trace_config *conf = FLT_CONF(filter);
- STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
+ FLT_STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
__FUNCTION__,
channel_label(chn), proxy_mode(s), stream_pos(s));
return 1;
@@ -408,7 +408,7 @@
struct htx_sl *sl = http_get_stline(htx);
int32_t pos;
- STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)\t%.*s %.*s %.*s",
+ FLT_STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)\t%.*s %.*s %.*s",
__FUNCTION__,
channel_label(msg->chn), proxy_mode(s), stream_pos(s),
HTX_SL_P1_LEN(sl), HTX_SL_P1_PTR(sl),
@@ -427,7 +427,7 @@
n = htx_get_blk_name(htx, blk);
v = htx_get_blk_value(htx, blk);
- STRM_TRACE(conf, s, "\t%.*s: %.*s",
+ FLT_STRM_TRACE(conf, s, "\t%.*s: %.*s",
(int)n.len, n.ptr, (int)v.len, v.ptr);
}
return 1;
@@ -469,7 +469,7 @@
}
}
- STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s) - "
+ FLT_STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s) - "
"offset=%u - len=%u - forward=%d",
__FUNCTION__,
channel_label(msg->chn), proxy_mode(s), stream_pos(s),
@@ -489,7 +489,7 @@
{
struct trace_config *conf = FLT_CONF(filter);
- STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
+ FLT_STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
__FUNCTION__,
channel_label(msg->chn), proxy_mode(s), stream_pos(s));
return 1;
@@ -501,7 +501,7 @@
{
struct trace_config *conf = FLT_CONF(filter);
- STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
+ FLT_STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
__FUNCTION__,
channel_label(msg->chn), proxy_mode(s), stream_pos(s));
}
@@ -512,7 +512,7 @@
{
struct trace_config *conf = FLT_CONF(filter);
- STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
+ FLT_STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s)",
__FUNCTION__, "-", proxy_mode(s), stream_pos(s));
}
@@ -529,7 +529,7 @@
if (ret && conf->rand_parsing)
ret = random() % (ret+1);
- STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s) - next=%u - avail=%u - consume=%d",
+ FLT_STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s) - next=%u - avail=%u - consume=%d",
__FUNCTION__,
channel_label(chn), proxy_mode(s), stream_pos(s),
FLT_NXT(filter, chn), avail, ret);
@@ -549,7 +549,7 @@
if (ret && conf->rand_forwarding)
ret = random() % (ret+1);
- STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s) - len=%u - fwd=%u - forward=%d",
+ FLT_STRM_TRACE(conf, s, "%-25s: channel=%-10s - mode=%-5s (%s) - len=%u - fwd=%u - forward=%d",
__FUNCTION__,
channel_label(chn), proxy_mode(s), stream_pos(s), len,
FLT_FWD(filter, chn), ret);