diff mbox

[FFmpeg-devel,2/2] avutil/log: print level prefix also when no AVClass context is available

Message ID 1521017723-28753-2-git-send-email-t.rapp@noa-archive.com
State Accepted
Commit 1296a718dc62728b6601f694539a1c5ad8ad260c
Headers show

Commit Message

Tobias Rapp March 14, 2018, 8:55 a.m. UTC
Adds the level prefix to all log messages, except those with level <=
AV_LOG_QUIET as they seem to be used for flushing the log buffer.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
---
 libavutil/log.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Michael Niedermayer March 15, 2018, 11:03 p.m. UTC | #1
On Wed, Mar 14, 2018 at 09:55:23AM +0100, Tobias Rapp wrote:
> Adds the level prefix to all log messages, except those with level <=
> AV_LOG_QUIET as they seem to be used for flushing the log buffer.
> 
> Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
> ---
>  libavutil/log.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

LGTM

thx

[...]
Tobias Rapp March 16, 2018, 8:10 a.m. UTC | #2
On 16.03.2018 00:03, Michael Niedermayer wrote:
> On Wed, Mar 14, 2018 at 09:55:23AM +0100, Tobias Rapp wrote:
>> Adds the level prefix to all log messages, except those with level <=
>> AV_LOG_QUIET as they seem to be used for flushing the log buffer.
>>
>> Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
>> ---
>>   libavutil/log.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> LGTM
> 
> thx

Pushed, thanks for review.

Regards,
Tobias
diff mbox

Patch

diff --git a/libavutil/log.c b/libavutil/log.c
index bd47f2a..9b7d484 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -266,11 +266,11 @@  static void format_line(void *avcl, int level, const char *fmt, va_list vl,
         av_bprintf(part+1, "[%s @ %p] ",
                  avc->item_name(avcl), avcl);
         if(type) type[1] = get_category(avcl);
-
-        if (flags & AV_LOG_PRINT_LEVEL)
-            av_bprintf(part+2, "[%s] ", get_level_str(level));
     }
 
+    if (*print_prefix && (level > AV_LOG_QUIET) && (flags & AV_LOG_PRINT_LEVEL))
+        av_bprintf(part+2, "[%s] ", get_level_str(level));
+
     av_vbprintf(part+3, fmt, vl);
 
     if(*part[0].str || *part[1].str || *part[2].str || *part[3].str) {