CLEANUP: halog: make the default usage message fit in small screens

The usage message was starting to have long lines, it's preferable that
it still fits well into a default 80-col display so that options are
easy to find. Also cut that into the 3 parts (input filter, modifier,
output format) for improved legibility.
This commit is contained in:
Willy Tarreau 2021-11-08 08:37:40 +01:00
parent 16cc16dd82
commit 87e7eafde4
1 changed files with 10 additions and 9 deletions

View File

@ -147,13 +147,14 @@ void usage(FILE *output, const char *msg)
{ {
fprintf(output, fprintf(output,
"%s" "%s"
"Usage: halog [-h|--help] for long help\n" "Usage:\n"
" halog [-q] [-c] [-m <lines>]\n" " halog [-h|--help] for long help\n"
" {-cc|-gt|-pct|-st|-tc|-srv|-u|-uc|-ue|-ua|-ut|-uao|-uto|-uba|-ubt|-ic\n" " halog [input_filters]* [modifiers]* [output_format] < log\n"
" |-hdr <block>:<field>\n" " inp = [-e|-E] [-H] [-Q|-QS] [-rt|-RT <time>] [-ad <delay>] [-ac <count>]\n"
" }\n" " [-hs|-HS [min][:[max]]] [-tcn|-TCN <termcode>] [-time [min][:[max]]]\n"
" [-s <skip>] [-e|-E] [-H] [-rt|-RT <time>] [-ad <delay>] [-ac <count>] [-query]\n" " mod = [-q] [-v] [-m <lines>] [-s <skipflds>] [-query]\n"
" [-v] [-Q|-QS] [-tcn|-TCN <termcode>] [ -hs|-HS [min][:[max]] ] [ -time [min][:[max]] <log\n" " out = {-c|-u|-uc|-ue|-ua|-ut|-uao|-uto|-uba|-ubt|-hdr <block>:<field>|\n"
" -cc|-gt|-pct|-st|-tc|-srv|-ic}\n"
"\n", "\n",
msg ? msg : "" msg ? msg : ""
); );
@ -169,7 +170,7 @@ void help()
{ {
usage(stdout, NULL); usage(stdout, NULL);
printf( printf(
"Input filters (several filters may be combined) :\n" "Input filters - several filters may be combined\n"
" -H only match lines containing HTTP logs (ignore TCP)\n" " -H only match lines containing HTTP logs (ignore TCP)\n"
" -E only match lines without any error (no 5xx status)\n" " -E only match lines without any error (no 5xx status)\n"
" -e only match lines with errors (status 5xx or negative)\n" " -e only match lines with errors (status 5xx or negative)\n"
@ -189,7 +190,7 @@ void help()
" you can also use -n to start from earlier then field %d\n" " you can also use -n to start from earlier then field %d\n"
" -query preserve the query string for per-URL (-u*) statistics\n" " -query preserve the query string for per-URL (-u*) statistics\n"
"\n" "\n"
"Output filters - only one may be used at a time\n" "Output format - only one may be used at a time\n"
" -c only report the number of lines that would have been printed\n" " -c only report the number of lines that would have been printed\n"
" -pct output connect and response times percentiles\n" " -pct output connect and response times percentiles\n"
" -st output number of requests per HTTP status code\n" " -st output number of requests per HTTP status code\n"