MINOR: trace: support -dt optional format

Add an optional argument for "-dt". This argument is interpreted as a
list of several trace statement separated by comma. For each statement,
a specific trace name can be specifed, or none to act on all sources.
Using double-colon separator, it is possible to add specifications on
the wanted level and verbosity.
This commit is contained in:
Amaury Denoyelle
2023-11-22 17:27:57 +01:00
parent 670520cff8
commit e97489a526
4 changed files with 117 additions and 12 deletions

View File

@@ -1708,7 +1708,17 @@ static void init_args(int argc, char **argv)
kwd_dump = flag + 2;
}
else if (*flag == 'd' && flag[1] == 't') {
trace_parse_cmd();
if (argc > 1 && argv[1][0] != '-') {
if (trace_parse_cmd(argv[1], &err_msg)) {
ha_alert("-dt: %s.\n", err_msg);
ha_free(&err_msg);
exit(EXIT_FAILURE);
}
argc--; argv++;
}
else {
trace_parse_cmd(NULL, NULL);
}
}
else if (*flag == 'd')
arg_mode |= MODE_DEBUG;