My Project
mrfCommon
src
debugPrint.h
1
/**************************************************************************************************
2
|* debugPrint.h -- Debug Printing Macros
3
|*
4
|*--------------------------------------------------------------------------------------------------
5
|* Authors: S.Allison (SLAC)
6
|* K.Luchini (SLAC)
7
|*
8
|* Date: 9 December 2004
9
|*
10
|*-------------------------------------------------------------------------------------------------
11
|* MODIFICATION HISTORY:
12
|* 09 Dec 2004 S.Allison Original
13
|* 19 Jan 2005 D.Rogind Added interest level definitions
14
|*
15
|*--------------------------------------------------------------------------------------------------
16
|* MODULE DESCRIPTION:
17
|*
18
|* This file contains the SLAC debug printing mechanism.
19
|*
20
|* To enable debug printing, add the following line to the EPICS Makefile:
21
|* #USR_CFLAGS += -DDEBUG_PRINT
22
|* When debug printout is desired, uncomment the line, clean, and rebuild.
23
|*
24
|* To use in a C file, add these lines to the appropriate places of <fileName>.c:
25
|* #include "debugPrint.h"
26
|* #ifdef DEBUG_PRINT
27
|* int <fileName>Flag = 0;
28
|* #endif
29
|*
30
|*-------------------------------------------------------------------------------------------------
31
|* CALLING SEQUENCE:
32
|* DEBUGPRINT (DP_XXX, InterestFlag, (printfArgs));
33
|*
34
|*-------------------------------------------------------------------------------------------------
35
|* INPUT PARAMETERS:
36
|* DP_XXX = Message severity. The six defined levels, in order of increasing
37
|* verbosity are:
38
|* DP_NONE
39
|* DP_FATAL
40
|* DP_ERROR
41
|* DP_WARN
42
|* DP_INFO
43
|* DP_DEBUG
44
|*
45
|* InterestFlag = Interest level threshold. Typically this has the form <fileName>Flag.
46
|* The debug message will be printed if the message severity code (DP_XXXX)
47
|* is less than or equal to the InterestFlag value.
48
|* printfArgs = Parameter list to the printf function. This typically takes the
49
|* form:
50
|* ("text with %s %d etc\n", arg0, arg1, ...)
51
|* Note that the enclosing parenthesis are required.
52
|*
53
\**************************************************************************************************/
54
␌
55
/**************************************************************************************************
56
|* COPYRIGHT NOTIFICATION
57
|**************************************************************************************************
58
|*
59
|* THE FOLLOWING IS A NOTICE OF COPYRIGHT, AVAILABILITY OF THE CODE,
60
|* AND DISCLAIMER WHICH MUST BE INCLUDED IN THE PROLOGUE OF THE CODE
61
|* AND IN ALL SOURCE LISTINGS OF THE CODE.
62
|*
63
|**************************************************************************************************
64
|*
65
|* Copyright (c) 2006 The Board of Trustees of the Leland Stanford Junior
66
|* University, as Operator of the Stanford Linear Accelerator Center.
67
|*
68
|**************************************************************************************************
69
|*
70
|* This software is distributed under the EPICS Open License Agreement which
71
|* can be found in the file, LICENSE, included with this distribution.
72
|*
73
\*************************************************************************************************/
74
␌
75
#ifndef DEBUGPRINT_H
76
#define DEBUGPRINT_H
77
78
/**************************************************************************************************/
79
/* Other Header Files Required By This File */
80
/**************************************************************************************************/
81
82
#include <stdio.h>
/* Standard C I/O routines */
83
84
/**************************************************************************************************/
85
/* Define Interest Levels */
86
/**************************************************************************************************/
87
88
#define DP_NONE 0
89
#define DP_FATAL 1
90
#define DP_ERROR 2
91
#define DP_WARN 3
92
#define DP_INFO 4
93
#define DP_DEBUG 5
94
95
/**************************************************************************************************/
96
/* Define the DEBUGPRINT Macro */
97
/**************************************************************************************************/
98
99
#ifdef DEBUG_PRINT
100
#define DEBUGPRINT(interest, globalFlag, args) {if (interest <= globalFlag) printf args;}
101
#else
102
#define DEBUGPRINT(interest, globalFlag, args)
103
#endif
104
105
106
#endif
/* guard */
Generated by
1.9.1