Quoting Hendrik Leppkes (2017-05-20 21:20:58)
> On Sat, May 20, 2017 at 9:15 PM, Anton Khirnov <an...@khirnov.net> wrote:
> > Quoting Martin Storsjö (2017-05-20 20:28:35)
> >> On Sat, 20 May 2017, Anton Khirnov wrote:
> >>
> >> > The default logging callback in lavu currently contains several
> >> > "advanced" features, such as
> >> > - suppressing repeated messages
> >> > - automatically hiding the log prefix
> >> > - color support
> >> > They add significant complexity to the logging callback and - more
> >> > importantly - global state, making logging not thread-safe (and strictly
> >> > speaking introducing UB).
> >> >
> >> > Many (perhaps most) of our callers either do not care for such fancy
> >> > features, or already use a custom logging callback. Therefore, it is
> >> > better to move them to cmdutils (for use by avtools) and leave the
> >> > default logging callback simple, straightforward and safe.
> >> > ---
> >> > I hope everyone agrees that having global state in the default logging 
> >> > callback
> >> > is a BadThing(tm).
> >> >
> >> > One thing for discussion is the logging prefix (the [mp3 @ 0xdeadface] 
> >> > thingy).
> >> > The current code checks whether the message contains a newline, and when 
> >> > it
> >> > doesn't it toggles a flag to skip the prefix on the next invocation. 
> >> > Since we
> >> > don't want such global flags, I see two possibilities:
> >> > * just abolish the prefices (what I did)
> >> > * print them always
> >> > Comments/other suggestions welcome.
> >>
> >> I kinda would like to keep the prefixes. Instead I'd prefer to always
> >> print them - in how many places do we even print a single log line by
> >> doing multiple av_log calls? I guess those can be fixed somehow (like by
> >> concatenating things into a local buffer in the caller).
> >
> > From what I recall it's not that rare, plus I'd rather not force this
> > extra constraint on all calls to av_log().
> >
> > One thing we could consider is changing the prefix into a suffix, which
> > is appended to the messages that end in a newline.
> >
> 
> That would look rather ugly. The good thing about the prefix is that
> its somewhat consistent in format and always at the beginning, making
> scanning for certain entries with your eyes relatively easy.

I certainly agree that it's less than perfect, but Martin's proposal has more
significant disadvantages IMO. And note that this will only be seen in programs
that do not bother to implement their own log callback (i.e. not in avconv and
other tools).

Or do you propose something else?

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to