#include <stdlib.h>
#include "shmlog.h"
+#include "heritage.h"
#include "vrt.h"
#include "vrt_obj.h"
#include "vcl.h"
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
- VSL(SLT_VCL_trace, sp->fd, "%u %d.%d", u,
- sp->vcl->ref[u].line,
- sp->vcl->ref[u].pos);
+ if (params->vcl_trace)
+ VSL(SLT_VCL_trace, sp->fd, "%u %d.%d", u,
+ sp->vcl->ref[u].line, sp->vcl->ref[u].pos);
}
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
+static void
+tweak_vcl_trace(struct cli *cli, struct parspec *par, const char *arg)
+{
+ (void)par;
+ if (arg != NULL) {
+ if (!strcasecmp(arg, "off"))
+ params->vcl_trace = 0;
+ else if (!strcasecmp(arg, "disable"))
+ params->vcl_trace = 0;
+ else if (!strcasecmp(arg, "no"))
+ params->vcl_trace = 0;
+ else if (!strcasecmp(arg, "on"))
+ params->vcl_trace = 1;
+ else if (!strcasecmp(arg, "enable"))
+ params->vcl_trace = 1;
+ else if (!strcasecmp(arg, "yes"))
+ params->vcl_trace = 1;
+ else {
+ cli_out(cli, "use \"on\" or \"off\"\n");
+ cli_result(cli, CLIS_PARAM);
+ return;
+ }
+ }
+ cli_out(cli, params->vcl_trace ? "on" : "off");
+}
+
+/*--------------------------------------------------------------------*/
+
/*
* Make sure to end all lines with either a space or newline of the
* formatting will go haywire.
"The minimum size of objects transmitted with sendfile.\n"
"Default is 8192 bytes.", "8192" },
#endif /* HAVE_SENDFILE */
+ { "vcl_trace", tweak_vcl_trace,
+ "Trace VCL execution in the shmlog\n"
+ "Default is off", "off" },
{ NULL, NULL, NULL }
};