nidas  v1.2-1520
klog.h
Go to the documentation of this file.
1 /* -*- mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8; -*- */
2 /* vim: set shiftwidth=8 softtabstop=8 expandtab: */
3 /*
4  ********************************************************************
5  ** NIDAS: NCAR In-situ Data Acquistion Software
6  **
7  ** 2007, Copyright University Corporation for Atmospheric Research
8  **
9  ** This program is free software; you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation; either version 2 of the License, or
12  ** (at your option) any later version.
13  **
14  ** This program is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** The LICENSE.txt file accompanying this software contains
20  ** a copy of the GNU General Public License. If it is not found,
21  ** write to the Free Software Foundation, Inc.,
22  ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  **
24  ********************************************************************
25 */
26 /*
27 
28  Handy macros for logging from kernel modules.
29 
30 */
31 
32 #ifndef NIDAS_LINUX_KLOG_H
33 #define NIDAS_LINUX_KLOG_H
34 
35 #ifdef __KERNEL__
36 
37 #include <linux/kernel.h>
38 #include <linux/module.h>
39 
40 #ifdef DEBUG
41 #define KLOG_DEBUG(fmt,args...) \
42  printk(KERN_DEBUG "%s: %s: DEBUG: " fmt,__FILE__,__FUNCTION__, ## args)
43 #else
44 #define KLOG_DEBUG(fmt,args...) /* nothing */
45 #endif
46 
47 #define KLOG_INFO(fmt,args...) \
48  printk(KERN_INFO "%s: INFO: " fmt, module_name(THIS_MODULE),## args)
49 #define KLOG_NOTICE(fmt,args...) \
50  printk(KERN_NOTICE "%s: NOTICE: " fmt, module_name(THIS_MODULE),## args)
51 #define KLOG_WARNING(fmt,args...) \
52  printk(KERN_WARNING "%s: WARNING: " fmt, module_name(THIS_MODULE),## args)
53 #define KLOG_ERR(fmt,args...) \
54  printk(KERN_ERR "%s: ERROR: " fmt, module_name(THIS_MODULE),## args)
55 #define KLOG_CRIT(fmt,args...) \
56  printk(KERN_CRIT "%s: CRITICAL: " fmt, module_name(THIS_MODULE),## args)
57 #define KLOG_ALERT(fmt,args...) \
58  printk(KERN_ALERT "%s: ALERT: " fmt, module_name(THIS_MODULE),## args)
59 #define KLOG_EMERG(fmt,args...) \
60  printk(KERN_EMERG "%s: EMERGENCY: " fmt, module_name(THIS_MODULE),## args)
61 
62 #endif
63 
64 #endif