[CRIU] Re: [PATCH 6/6] log: Add log-levels

Cyrill Gorcunov gorcunov at openvz.org
Fri Feb 17 12:55:31 EST 2012


On Fri, Feb 17, 2012 at 09:50:45PM +0400, Pavel Emelyanov wrote:
> >  #ifdef CR_DEBUG
> > -#define pr_debug(fmt, ...)					\
> > -	do {							\
> > -		printk("%s:%d:%s: " fmt,			\
> > -		       __FILE__, __LINE__,__func__,		\
> > -		       ##__VA_ARGS__);				\
> > -	} while (0)
> > -#define dprintk(fmt, ...)	printk(fmt, ##__VA_ARGS__)
> > +#define dprintk(fmt, ...)	printk_level(LOG_DEBUG, fmt, ##__VA_ARGS__)
> >  #else
> > -#define pr_debug(fmt, ...)
> >  #define dprintk(fmt, ...)
> >  #endif
> 
> There should be no such things.
>

ok

> 
> Loglevel is a bitmask? O_o
> 
> #define LOG_ERR 0
> #define LOG_WARN 1
> #define LOG_DBG 2
> 
> loglevel = LOG_WARN
> 
> void printk_level(level, msg)
> {
> 	if (level > loglevel)
> 		return;
> 
> 	/* print the message */
> }

but, say if you need debug level, the error
messages should be printed as well, this is
what bitmask about.

	Cyrill


More information about the CRIU mailing list