Browse code

debugger: added cfgtrace_format parameter

- control what is printed in the cfgtrace log message (e.g., do not
print config file path)

Daniel-Constantin Mierla authored on 29/07/2021 10:59:13
Showing 3 changed files
... ...
@@ -149,6 +149,13 @@ str *dbg_get_cmd_name(int t)
149 149
  */
150 150
 int _dbg_cfgtrace = 0;
151 151
 
152
+#define DBG_CFGTRACE_NOCFGFILE (1<<0)
153
+/**
154
+ *
155
+ */
156
+int _dbg_cfgtrace_format = 0;
157
+
158
+
152 159
 /**
153 160
  *
154 161
  */
... ...
@@ -359,13 +366,23 @@ int dbg_cfg_trace(sr_event_param_t *evp)
359 366
 	{
360 367
 		if(is_printable(_dbg_cfgtrace_level))
361 368
 		{
362
-			LOG_FL(_dbg_cfgtrace_facility, _dbg_cfgtrace_level,
363
-					_dbg_cfgtrace_lname, _dbg_cfgtrace_prefix,
364
-					"%s=[%s] c=[%s] l=%d a=%d n=%.*s\n",
365
-					get_current_route_type_name(), ZSW(a->rname),
366
-					ZSW(a->cfile), a->cline,
367
-					a->type, an->len, ZSW(an->s)
368
-				);
369
+			if(unlikely(_dbg_cfgtrace_format & DBG_CFGTRACE_NOCFGFILE)) {
370
+				LOG_FL(_dbg_cfgtrace_facility, _dbg_cfgtrace_level,
371
+						_dbg_cfgtrace_lname, _dbg_cfgtrace_prefix,
372
+						"%s=[%s] l=%d a=%d n=%.*s\n",
373
+						get_current_route_type_name(), ZSW(a->rname),
374
+						a->cline,
375
+						a->type, an->len, ZSW(an->s)
376
+					);
377
+			} else {
378
+				LOG_FL(_dbg_cfgtrace_facility, _dbg_cfgtrace_level,
379
+						_dbg_cfgtrace_lname, _dbg_cfgtrace_prefix,
380
+						"%s=[%s] c=[%s] l=%d a=%d n=%.*s\n",
381
+						get_current_route_type_name(), ZSW(a->rname),
382
+						ZSW(a->cfile), a->cline,
383
+						a->type, an->len, ZSW(an->s)
384
+					);
385
+			}
369 386
 		}
370 387
 	}
371 388
 	if(_dbg_pid_list[process_no].set&DBG_CFGTEST_ON)
... ...
@@ -62,6 +62,7 @@ extern char* dump_lump_list(struct lump *list, int s_offset, char *s_buf);
62 62
 
63 63
 /* parameters */
64 64
 extern int _dbg_cfgtrace;
65
+extern int _dbg_cfgtrace_format;
65 66
 extern int _dbg_cfgpkgcheck;
66 67
 extern int _dbg_breakpoint;
67 68
 extern int _dbg_cfgtrace_level;
... ...
@@ -100,6 +101,7 @@ static cmd_export_t cmds[]={
100 101
 
101 102
 static param_export_t params[]={
102 103
 	{"cfgtrace",          INT_PARAM, &_dbg_cfgtrace},
104
+	{"cfgtrace_format",   INT_PARAM, &_dbg_cfgtrace_format},
103 105
 	{"breakpoint",        INT_PARAM, &_dbg_breakpoint},
104 106
 	{"log_level",         INT_PARAM, &_dbg_cfgtrace_level},
105 107
 	{"log_facility",      PARAM_STRING, &_dbg_cfgtrace_facility_str},
... ...
@@ -101,6 +101,29 @@ modparam("debugger", "cfgtrace", 1)
101 101
 	    </example>
102 102
 	</section>
103 103
 
104
+	<section id="dbg.p.cfgtrace_format">
105
+	    <title><varname>cfgtrace_format</varname> (int)</title>
106
+	    <para>
107
+			Control what is printer in the cfgtrace log message. If it is set
108
+			to 1, then the configuration file path is not printed, making
109
+			the log messages shorter when not including other configuration
110
+			files in the main one.
111
+	    </para>
112
+	    <para>
113
+		<emphasis>
114
+		    Default value is <quote>0</quote>.
115
+		</emphasis>
116
+	    </para>
117
+	    <example>
118
+		<title>Set <varname>cfgtrace_format</varname> parameter</title>
119
+		<programlisting format="linespecific">
120
+...
121
+modparam("debugger", "cfgtrace_format", 1)
122
+...
123
+</programlisting>
124
+	    </example>
125
+	</section>
126
+
104 127
 	<section id="dbg.p.breakpoint">
105 128
 	    <title><varname>breakpoint</varname> (int)</title>
106 129
 	    <para>