📄 log.h
字号:
/* log.h * linqianghe@163.com * 2006-09-01 */#ifndef INCLUDED_LOG_H#define INCLUDED_LOG_H#define __SHORTFILE__ \ ({\ char *header = __FILE__; \ char *ptr = header + strlen( header ) - 1; \ while( *ptr != '/' && ptr != header ) \ ptr --; \ if( *ptr == '/')\ ptr ++;\ ptr; \ })#ifdef __KERNEL__ #define PR_TRACE( fmt, args... )\ printk( KERN_ERR "%s[%d]:%s[TRACE]: " fmt, __SHORTFILE__, \ __LINE__, __FUNCTION__, ##args ) #define PR_TRACEC( fmt, args... ) #define PR_ERR( fmt, args... ) \ printk( KERN_ERR "%s[%d]:%s[ERR]: " fmt, __SHORTFILE__, \ __LINE__, __FUNCTION__, ##args ) #define PR_WARN( fmt, args... ) \ printk( KERN_WARNING "%s[%d]:%s[WARNING]: " fmt, __SHORTFILE__, \ __LINE__, __FUNCTION__, ##args ) #define PR_NOTICE( fmt, args... ) \ printk(KERN_NOTICE "%s[%d]:%s[NOTICE]: " fmt, __SHORTFILE__, \ __LINE__, __FUNCTION__, ##args ) #ifdef MYIPV4_DEEP_DEBUG #define PR_DEEP_DEBUG( fmt, args... ) \ printk( KERN_NOTICE "%s[%d]:%s[DEBUG]: " fmt, __SHORTFILE__, \ __LINE__, __FUNCTION__, ##args ) #else #define PR_DEEP_DEBUG( fmt, args... ) #endif #ifdef MYIPV4_DEBUG #define PR_DEBUG( fmt, args... ) \ printk( KERN_NOTICE "%s[%d]:%s[DEBUG]: " fmt, __SHORTFILE__, \ __LINE__, __FUNCTION__, ##args ) #else #define PR_DEBUG( fmt, args... ) #endif#else #include <string.h> #define PR_ERR( fmt, args... ) \ fprintf( stderr, "%s[%d]:%s[ERR]: " fmt, __SHORTFILE__, \ __LINE__, __FUNCTION__, ##args ) #define PR_WARN( fmt, args... ) \ fprintf( stderr, "%s[%d]:%s[WARNING]: " fmt, __SHORTFILE__, \ __LINE__, __FUNCTION__, ##args ) #define PR_NOTICE( fmt, args... ) \ fprintf( stdout, "%s[%d]:%s[NOTICE]: " fmt, __SHORTFILE__, \ __LINE__, __FUNCTION__, ##args ) #ifdef APP_DEBUG #define PR_DEBUG( fmt, args... ) \ fprintf( stdout, "%s[%d]:%s[DEBUG]: " fmt, __SHORTFILE__, \ __LINE__, __FUNCTION__, ##args ) #else #define PR_DEBUG( fmt, args... ) #endif#endif#endif //INCLUDED_LOG_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -