在/linux/kernel.h中定义了打印的级别console_loglevel以及缺省的打印级别default_message_loglevel:
#define console_loglevel (console_printk[0])
#define default_message_loglevel (console_printk[1])
console_printk[]数组定义为:
int console_printk[4] = {
DEFAULT_CONSOLE_LOGLEVEL, /* console_loglevel */
DEFAULT_MESSAGE_LOGLEVEL, /* default_message_loglevel */
MINIMUM_CONSOLE_LOGLEVEL, /* minimum_console_loglevel */
DEFAULT_CONSOLE_LOGLEVEL, /* default_console_loglevel */
};
#define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */
/* We show everything that is MORE important than this.. */
#define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */
#define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */
可见,打印级别为DEFAULT_CONSOLE_LOGLEVEL=7,任何小于该级别的输出都会显示在终端上。我们可以修改console_loglevel以控制打印输出。