Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Soft Works <softworkz-at-hotmail.com@ffmpeg.org>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v5 2/3] fftools/opt_common: add time and datetime log flags
Date: Fri, 7 Feb 2025 14:19:57 +0000
Message-ID: <DM8P223MB03652BCDA1C16DCEE9554A90BAF12@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <6d7c527b-b834-4c08-9d16-90e033f28f45@noa-archive.com>



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Tobias Rapp
> Sent: Friday, February 7, 2025 2:22 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v5 2/3] fftools/opt_common: add
> time and datetime log flags
> 
> On 07/02/2025 12:27, Soft Works wrote:
> 
> >
> >> -----Original Message-----
> >> From: ffmpeg-devel<ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> >> Tobias Rapp
> >> Sent: Friday, February 7, 2025 11:42 AM
> >> To:ffmpeg-devel@ffmpeg.org
> >> Subject: Re: [FFmpeg-devel] [PATCH v5 2/3] fftools/opt_common: add
> >> time and datetime log flags
> >>
> >> On 07/02/2025 08:57, softworkz wrote:
> >>
> >>> From: softworkz<softworkz@hotmail.com>
> >>>
> >>> This commit adds two logging flags: 'time' and 'datetime'.
> >>>
> >>> Usage:
> >>>
> >>> ffmpeg -loglevel +time
> >>>
> >>> or
> >>>
> >>> ffmpeg -loglevel +datetime
> >>>
> >>> Setting av_log_set_flags(0) in term_exit in ffmpeg.c prevents
> >>> timing to be printed when exiting.
> >>>
> >>> Signed-off-by: softworkz<softworkz@hotmail.com>
> >>> ---
> >>>    fftools/ffmpeg.c     |  1 +
> >>>    fftools/opt_common.c | 12 ++++++++++++
> >>>    2 files changed, 13 insertions(+)
> >>>
> >>> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> >>> index dc321fb4a2..f4c717afaa 100644
> >>> --- a/fftools/ffmpeg.c
> >>> +++ b/fftools/ffmpeg.c
> >>> @@ -130,6 +130,7 @@ static void term_exit_sigsafe(void)
> >>>
> >>>    void term_exit(void)
> >>>    {
> >>> +    av_log_set_flags(0);
> >>>        av_log(NULL, AV_LOG_QUIET, "%s", "");
> >>>        term_exit_sigsafe();
> >>>    }
> >> If I understand the purpose of AV_LOG_QUIET correctly the correct
> way
> >> would be to skip writing time/datetime information in the log
> writer
> >> itself (part of patch #1 in this patch-set) if level is <=
> >> AV_LOG_QUIET,
> >> rather than clearing the flags here.
> >>
> >> Regards,
> >> Tobias
> >
> > Hi Tobias,
> >
> > my understanding of AV_LOG_QUIET would be that when program code
> logs a message with that level, it will be printed even when the user
> has "-loglevel quiet".
> > I would wonder why such log messages shouldn't be prefixed with the
> time (normally).
> > To me it appears that the special case is rather the log invocation
> on exit which prints - well: nothing.
> >
> > I'd rather question why it is not printing the log level for quiet.
> Is it really intended or was it only done to make it possible to
> print this empty message on exit?
> >
> > Do I see it wrong? Then I'll change it of course.
> >
> > Thanks a lot for reviewing!
> >
> > sw
> 
> The documentation for AV_LOG_QUIET in log.h says "Print no output"

This is the user-facing definition. When a user configures quiet, it means that ffmpeg prints no output. But on the side of the code, specifying AV_LOG_QUIET doesn't mean "print no output" but the opposite ("print it, no matter what!").


> from grepping through code it seems the implementation matches that
> definition. The purpose of av_log(NULL, AV_LOG_QUIET, "%s", "") is
> described with the AV_LOG_SKIP_REPEATED flag, see
> https://ffmpeg.org/doxygen/trunk/group__lavu__log.html#ga6cdf5cd331b1
> 7e80e8308124f05a6db8

Hm, not sure whether this has been the original purpose of AV_LOG_QUIET. 
And one could argue that consumers of avutil might use this log level for printing non-empty messages. That's what the snippet above would have preserved working.
But the quirky part has already happened (not introducing av_log_flush() or something), so - as a whole - it can't be easily remedied anyway.


> So I suggest to just add a "(level > AV_LOG_QUIET)" clause to the
> added
> lines in forma_line(), similar to how it is done with the loglevel
> prefix in that function some lines below:
> 
> if (*print_prefix && (level > AV_LOG_QUIET) && (flags &
> (AV_LOG_PRINT_TIME | AV_LOG_PRINT_DATETIME)))
>      format_date_now(&part[4], flags & AV_LOG_PRINT_DATETIME);

Fine. Done for the next version,
thank you very much!

sw
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2025-02-07 14:20 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24 19:37 [FFmpeg-devel] [PATCH 0/3] Add option to log timing ffmpegagent
2022-08-24 19:37 ` [FFmpeg-devel] [PATCH 1/3] avutil/log: support logging of date and timing information softworkz
2022-08-24 19:37 ` [FFmpeg-devel] [PATCH 2/3] fftools/opt_common: add timing and datetiming log flags softworkz
2022-08-24 19:37 ` [FFmpeg-devel] [PATCH 3/3] doc/fftools-common-opts: document log timing flags softworkz
2022-12-12 23:10 ` [FFmpeg-devel] [PATCH 0/3] Add option to log timing Soft Works
2025-01-30  3:53 ` [FFmpeg-devel] [PATCH v2 " ffmpegagent
2025-01-30  3:53   ` [FFmpeg-devel] [PATCH v2 1/3] avutil/log: support logging of date and timing information softworkz
2025-01-30  3:53   ` [FFmpeg-devel] [PATCH v2 2/3] fftools/opt_common: add timing and datetiming log flags softworkz
2025-02-02  1:13     ` Michael Niedermayer
2025-02-02  1:38       ` Soft Works
2025-01-30  3:53   ` [FFmpeg-devel] [PATCH v2 3/3] doc/fftools-common-opts: document log timing flags softworkz
2025-02-07  1:26   ` [FFmpeg-devel] [PATCH v3 0/3] Add option to log timing ffmpegagent
2025-02-07  1:26     ` [FFmpeg-devel] [PATCH v3 1/3] avutil/log: support logging of date and timing information softworkz
2025-02-07  1:26     ` [FFmpeg-devel] [PATCH v3 2/3] fftools/opt_common: add timing and datetiming log flags softworkz
2025-02-07  1:26     ` [FFmpeg-devel] [PATCH v3 3/3] doc/fftools-common-opts: document log timing flags softworkz
2025-02-07  3:58     ` [FFmpeg-devel] [PATCH v3 0/3] Add option to log timing Marth64
2025-02-07  4:37       ` Soft Works
2025-02-07  4:47         ` Marth64
2025-02-07  4:53           ` Marth64
2025-02-07  5:05           ` Soft Works
2025-02-07  5:15             ` Marth64
2025-02-07  6:27     ` [FFmpeg-devel] [PATCH v4 " ffmpegagent
2025-02-07  6:27       ` [FFmpeg-devel] [PATCH v4 1/3] avutil/log: support logging of date and timing information softworkz
2025-02-07  6:27       ` [FFmpeg-devel] [PATCH v4 2/3] fftools/opt_common: add timing and datetiming log flags softworkz
2025-02-07  6:46         ` epirat07
2025-02-07  6:54           ` Soft Works
2025-02-07  6:27       ` [FFmpeg-devel] [PATCH v4 3/3] doc/fftools-common-opts: document log timing flags softworkz
2025-02-07  7:57       ` [FFmpeg-devel] [PATCH v5 0/3] Add option to log timing ffmpegagent
2025-02-07  7:57         ` [FFmpeg-devel] [PATCH v5 1/3] avutil/log: support logging of date and time information softworkz
2025-02-07  7:57         ` [FFmpeg-devel] [PATCH v5 2/3] fftools/opt_common: add time and datetime log flags softworkz
2025-02-07 10:42           ` Tobias Rapp
2025-02-07 11:27             ` Soft Works
2025-02-07 12:03               ` Soft Works
2025-02-07 13:21               ` Tobias Rapp
2025-02-07 14:19                 ` Soft Works [this message]
2025-02-07  7:57         ` [FFmpeg-devel] [PATCH v5 3/3] doc/fftools-common-opts: document log timing flags softworkz
2025-02-07 14:34         ` [FFmpeg-devel] [PATCH v6 0/3] Add option to log timing ffmpegagent
2025-02-07 14:34           ` [FFmpeg-devel] [PATCH v6 1/3] avutil/log: support logging of date and time information softworkz
2025-02-07 14:34           ` [FFmpeg-devel] [PATCH v6 2/3] fftools/opt_common: add time and datetime log flags softworkz
2025-02-07 14:34           ` [FFmpeg-devel] [PATCH v6 3/3] doc/fftools-common-opts: document log timing flags softworkz
2025-02-07 15:57           ` [FFmpeg-devel] [PATCH v6 0/3] Add option to log timing Tobias Rapp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM8P223MB03652BCDA1C16DCEE9554A90BAF12@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM \
    --to=softworkz-at-hotmail.com@ffmpeg.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git