Message ID | ac5bc6b4-ed24-1cc5-8d10-234d972e4a07@gyani.pro |
---|---|
State | Accepted |
Headers | show |
On 09-09-2019 11:44 PM, Gyan wrote: > From 9581ee61d2eaeac1cf2a0262d010e95d316228db Mon Sep 17 00:00:00 2001 > From: Gyan Doshi <ffmpeg@gyani.pro> > Date: Mon, 9 Sep 2019 23:37:08 +0530 > Subject: [PATCH] cmdutils: promote report level if loglevel is higher Plan to push tonight. Gyan
On Mon, Sep 09, 2019 at 23:44:14 +0530, Gyan wrote: > Subject: [PATCH] cmdutils: promote report level if loglevel is higher Would it also be useful to be able to reduce the report's log level, or would that lead to incomplete bug reports? My use case: cron sometimes doesn't catch all output for peculiar reasons, so I want to use the report file, but not at its default log level. > - "Report written to \"%s\"\n", > + "Report written to \"%s\"\n" > + "Log level: %d \n", Superfluous whitespace (while writing this comment in an email creates 100s of kBs). Moritz
On 12-09-2019 02:04 PM, Moritz Barsnick wrote: > On Mon, Sep 09, 2019 at 23:44:14 +0530, Gyan wrote: >> Subject: [PATCH] cmdutils: promote report level if loglevel is higher > Would it also be useful to be able to reduce the report's log level, or > would that lead to incomplete bug reports? Yes, useless. With loglevels below info, even the command won't get printed. The user can continue to force a report level using FFREPORT. >> - "Report written to \"%s\"\n", >> + "Report written to \"%s\"\n" >> + "Log level: %d \n", > Superfluous whitespace (while writing this comment in an email creates > 100s of kBs). Will remove. Thanks, Gyan
On 12-09-2019 07:11 PM, Gyan wrote: > > > On 12-09-2019 02:04 PM, Moritz Barsnick wrote: >> On Mon, Sep 09, 2019 at 23:44:14 +0530, Gyan wrote: >>> Subject: [PATCH] cmdutils: promote report level if loglevel is higher >> Would it also be useful to be able to reduce the report's log level, or >> would that lead to incomplete bug reports? > Yes, useless. With loglevels below info, even the command won't get > printed. The user can continue to force a report level using FFREPORT. >>> - "Report written to \"%s\"\n", >>> + "Report written to \"%s\"\n" >>> + "Log level: %d \n", >> Superfluous whitespace (while writing this comment in an email creates >> 100s of kBs). > > Will remove. Pushed as 09933279396ed78e9ebbd44b587878d3ae772b3b Gyan
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index fdcd376b76..5705fcf4c5 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -980,6 +980,7 @@ static int init_report(const char *env) char *filename_template = NULL; char *key, *val; int ret, count = 0; + int prog_loglevel, envlevel = 0; time_t now; struct tm *tm; AVBPrint filename; @@ -1011,6 +1012,7 @@ static int init_report(const char *env) av_log(NULL, AV_LOG_FATAL, "Invalid report file level\n"); exit_program(1); } + envlevel = 1; } else { av_log(NULL, AV_LOG_ERROR, "Unknown key '%s' in FFREPORT\n", key); } @@ -1027,6 +1029,10 @@ static int init_report(const char *env) return AVERROR(ENOMEM); } + prog_loglevel = av_log_get_level(); + if (!envlevel) + report_file_level = FFMAX(report_file_level, prog_loglevel); + report_file = fopen(filename.str, "w"); if (!report_file) { int ret = AVERROR(errno); @@ -1037,11 +1043,12 @@ static int init_report(const char *env) av_log_set_callback(log_callback_report); av_log(NULL, AV_LOG_INFO, "%s started on %04d-%02d-%02d at %02d:%02d:%02d\n" - "Report written to \"%s\"\n", + "Report written to \"%s\"\n" + "Log level: %d \n", program_name, tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, - filename.str); + filename.str, report_file_level); av_bprint_finalize(&filename, NULL); return 0; }
From 9581ee61d2eaeac1cf2a0262d010e95d316228db Mon Sep 17 00:00:00 2001 From: Gyan Doshi <ffmpeg@gyani.pro> Date: Mon, 9 Sep 2019 23:37:08 +0530 Subject: [PATCH] cmdutils: promote report level if loglevel is higher --- fftools/cmdutils.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)