[Lldb-commits] [lldb] r236174 - Introduce a NullLog class, which ignores all messages.

Zachary Turner zturner at google.com
Thu Apr 30 10:26:08 PDT 2015


This could work, but maybe something like:

LOGIF_ALL(Flags, ...)
LOGIF_ANY(Flags, ...)

WARNIF_ALL(Flags, ...)
WARNIF_ANY(Flags, ...)

You have to reevaluate the flags every time, but that's only one comparison
and a bitwise operation, and it gives extra flexibility because you can
have log on many different conditions in the same function
On Thu, Apr 30, 2015 at 1:13 AM Pavel Labath <labath at google.com> wrote:

> I've been also thinking about this, but afraid to suggest anything. :)
> Anyway, now that the topic is up...
>
> If we want to decrease visual noise *and* avoid performance impact,
> why not make it a macro? E.g., something like
> #define LOGIF(log, ...) if(log) log->Printf(__VA_ARGS__)
>
> I know macros aren't really a thing right now, but I think this is a
> rather simple one and will improve readability without any performance
> impact.
>
> two cents.
>
> cheers,
> pl
>
>
>
> On 30 April 2015 at 07:44, Jason Molenda <jason at molenda.com> wrote:
> >
> >> On Apr 29, 2015, at 7:23 PM, Zachary Turner <zturner at google.com> wrote:
> >>
> >> What do you think about Enrico's suggestion? If there's a way to make
> this useful for everyone it's certainly better than me doing my own thing
> in ProcessWindows, but when i look at my code decorated with log statements
> using the existing paradigm, it's significantly harder to read than using
> the NullLog paradigm, so i guess i will still move it to ProcessWindows if
> that's the only way.
> >>
> >
> >
> > My two cents, I agree with Jim on this, I'd prefer we maintain the
> current form of logging throughout the codebase.
> >
> > In the unwinder, I wanted to have a consistent format style for all my
> logging -- in RegisterContextLLDB all of the logging calls UnwindLogMsg()
> unconditionally.  In that method I check if logging is enabled and add the
> standard formatting before the msg.
> >
> > J
> > _______________________________________________
> > lldb-commits mailing list
> > lldb-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150430/4064695a/attachment.html>


More information about the lldb-commits mailing list