From patchwork Mon Sep 9 18:14:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 14987 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id F081344A2C0 for ; Mon, 9 Sep 2019 21:14:26 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CC3E1687F97; Mon, 9 Sep 2019 21:14:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mx2.mailbox.org (mx2.mailbox.org [80.241.60.215]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 21083680508 for ; Mon, 9 Sep 2019 21:14:21 +0300 (EEST) Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 567FBA11E7 for ; Mon, 9 Sep 2019 20:14:20 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id tVN0yj3Gm3qF for ; Mon, 9 Sep 2019 20:14:17 +0200 (CEST) To: FFmpeg development discussions and patches From: Gyan Message-ID: Date: Mon, 9 Sep 2019 23:44:14 +0530 MIME-Version: 1.0 Content-Language: en-US Subject: [FFmpeg-devel] [PATCH] cmdutils: promote report level if loglevel is higher X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From 9581ee61d2eaeac1cf2a0262d010e95d316228db Mon Sep 17 00:00:00 2001 From: Gyan Doshi 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(-) 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; }