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.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to