[neomutt-devel] Quick Vote: Debugging Aids
Thomas Adam
thomas at xteddy.org
Fri Sep 1 11:12:49 CEST 2017
On Tue, Aug 29, 2017 at 12:05:45PM +0100, Richard Russon wrote:
> Hi guys,
>
> I've a couple of things for quick discussion...
> If they're liked, we can discuss them more fully in an issue.
>
> ---
> * Turn mutt_debug() into a macro.
>
> Change the proto (abbrev) from:
> void mutt_debug(level, fmt, ...);
> to
> void _mutt_debug(file, line, func, level, fmt, ...);
>
> add macro
> #define mutt_debug(l,f,...) _mutt_debug(__FILE__, __LINE__, __func__, l, f, ...)
>
> then I'd suggest:
> debug level 1,2: brief log messages (as normal)
> debug level >2: full details for every line
>
> This could be an 'easy' task
>
> VOTE: mutt_debug() macro
> * Yes
> * No
No. I have never found logging levels to be useful at all. If you've turned
the use of mutt_debug() on, then you get everything, or nothing. With
different log levels, it's up to both the programmer, and the person using it,
to know which log-level is best.
> ---
>
> * assert()/bug_on()
>
> We have lots of checks:
> if (!ptr)
> return;
>
> I propose replacing them with a macro:
> return_if_fail(ptr);
> return_val_if_fail(ptr, false);
>
> With DEBUG enabled, they log the file,line,func,test.
> Otherwise, they just return as normal.
>
> Note: glibc has a backtrace() function which could be used here.
>
> VOTE: assert-like macro
> * Yes
> * No
> * Don't know
Don't know. I'm not sure what value this is going to add.
-- Thomas Adam
More information about the neomutt-devel
mailing list