2016-11-23 12:14 GMT+01:00 [email protected] <[email protected]>:
> Hi
>
>
> In the past I have to build a few applications with C/C++ and I found #ifdef
> directives everywhere to be ugly and confusing. For example, using ifdef
> DEBUG to enable/disable debug messages.

depends on the use case (you can't do everything without #ifdef), but
full ack on debug message.

>
> That's why I opt to use functions which behavior was defined depending on
> compile headers/source files. For example, define log_debug(...) as NOOP or
> sleep() depending on platform.
>
> Have you considered doing something like this?

yup, the function is named DBGPRINTF() and some helpers. Being used
since ~1970 (the original dbgprintf() call stems back to the original
code ;)). Sometimes we use #ifdef DEBUG, but only if we actually need
to compute something beyond simple output generation (e.g. iterate
over a structure). This can't be done efficiently without #ifdef.

>
>
> Also, some time ago I started playing with "component" debugging, which
> enabled debug only for specific components. For example, setting
> RSYSLOG_DEBUG_MODULES_C will enable debug just for modules_c file, but it
> will be very verbosed
>
> Have you considered doing something like this?

similar, a verbosity level, and partial support is available via the
RSYSLOG_DEBUG variable (you can turn on/off some debugging features).
But it's still in its infancy. Would really be good to have.

Rainer
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to