[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnash-dev] Logging code
From: |
strk |
Subject: |
Re: [Gnash-dev] Logging code |
Date: |
Tue, 8 Aug 2006 10:36:52 +0200 |
Actually, I tought again about this, and I think
that the original IF_VERBOSE_ACTION() and friends
approach was the best.
This is because it allows checking for the -va -vp
flags once in a block rather then for each call.
And also, to competely avoid evaluating args to
the logging functions.
--strk;
On Tue, Aug 08, 2006 at 10:17:27AM +0200, strk wrote:
> This is a good one, but how would we then remove
> DEBUG, ACTION and PARSE w/out removing ERROR and WARNING
> at compile-time ?
>
> We might keep different macros for different "levels" but
> keep the double parens:
>
> #if VERBOSE_ACTION
> #define log_action(x) printf x;
> #else
> #define log_action(x)
> #endif
>
> log_action( ("%s", str) );
>
> --strk;
>
>
> On Mon, Aug 07, 2006 at 01:06:27PM -0700, John Gilmore wrote:
> > > The only problem would be the variable args part.
> > >
> > > What would you think about defining macros like:
> > >
> > >
> > > log_msg1()
> > > log_msg2()
> > > log_msgN()
> >
> > Just use double parentheses:
> >
> > log_msg_if_debugflag(DEB_NOISE, ("%s: %d invalid", p, i));
> >
> > #define log_msg_if_debugflag(flag,args) if (debugflags & flag) printf args
> >
> > [You probably want a do-while0 around that to avoid spurious matching of
> > "else" statements, thus:]
> >
> > #define log_msg_if_debugflag(flag,args) do { \
> > if (debugflags & flag) printf args; \
> > } while (0)
> >
> > John
> >
> >
> > _______________________________________________
> > Gnash-dev mailing list
> > address@hidden
> > http://lists.gnu.org/mailman/listinfo/gnash-dev
>
> --
>
> /"\ ASCII Ribbon Campaign
> \ / Respect for low technology.
> X Keep e-mail messages readable by any computer system.
> / \ Keep it ASCII.
>
>
>
> _______________________________________________
> Gnash-dev mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/gnash-dev
--
/"\ ASCII Ribbon Campaign
\ / Respect for low technology.
X Keep e-mail messages readable by any computer system.
/ \ Keep it ASCII.