[asterisk-dev] ast_debug() vs ast_log(LOG_DEBUG, ...) vs ast_log(AST_LOG_DEBUG, ...)

Tilghman Lesher tilghman at meg.abyt.es
Tue Jan 4 04:09:40 CST 2011


On Tuesday 04 January 2011 03:02:34 Klaus Darilion wrote:
> Am 03.01.2011 18:07, schrieb Russell Bryant:
> > On Wed, 2010-12-22 at 10:25 -0800, Kirill Katsnelson wrote:
> >> There are 190 invocations of ast_log(LOG_DEBUG,...) on the current
> >> trunk head, and about 3000 of ast_debug(). Are these 190 not gated
> >> by debug level on purpose?
> >> 
> >> I am asking because 1.8 outputs 2 debug lines, want it or not, per
> >> every call. It was a nice feature in 1.6 to be able to enable or
> >> disable debug on the fly in 1.6 by just setting "core set debug N"
> >> instead of changing and reloading logger.conf.
> >> 
> >> If that was not done on purpose, it would be nice to see that fixed.
> >> Those 2 printed out of 6 calls to ast_log() in
> >> ast_set_owners_and_peers() are killing me. I can upload a patch for
> >> these 6, but thought it might be ideal to get it fixed en masse in
> >> all 200 places -- assuming this is not currently right.
> > 
> > I can't think of any reason ast_log(LOG_DEBUG, ...) should be used
> > directly.  They should all be converted to ast_debug().
> 
> I tried reading the code but fail to understand the difference between
> those two, and why there is this wrapper for DEBUG, but no wrappers for
> other log levels.
> 
> It would be great if someone can enlighten me.

Simple.  There are only two log levels which have levels other than on and
off:  verbose and debug, which are controlled, respectively, by the -v and
-d options to Asterisk.  All other log levels are turned on, if they are
mentioned in logger.conf; otherwise, they are not.

-- 
Tilghman



More information about the asterisk-dev mailing list