1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
/* logger.h - logging routines */
/*
* isode/h/logger.h
*/
/*
* NOTICE
*
* Acquisition, use, and distribution of this module and related
* materials are subject to the restrictions of a license agreement.
* Consult the Preface in the User's Manual for the full terms of
* this agreement.
*
*/
#ifndef _LOGGER_
#define _LOGGER_
#include "manifest.h"
/* */
typedef struct ll_struct {
char *ll_file; /* path name to logging file */
char *ll_hdr; /* text to put in opening line */
char *ll_dhdr; /* dynamic header - changes */
int ll_events; /* interesting events */
#define LLOG_NONE 0
#define LLOG_FATAL 0x01 /* fatal errors */
#define LLOG_EXCEPTIONS 0x02 /* exceptional events */
#define LLOG_NOTICE 0x04 /* informational notices */
#define LLOG_PDUS 0x08 /* PDU printing */
#define LLOG_TRACE 0x10 /* program tracing */
#define LLOG_DEBUG 0x20 /* full debugging */
#define LLOG_ALL 0xff
#define LLOG_MASK \
"\020\01FATAL\02EXCEPTIONS\03NOTICE\04PDUS\05TRACE\06DEBUG"
int ll_syslog; /* interesting events to send to syslog */
/* takes same values as ll_events */
int ll_msize; /* max size for log, in Kbytes */
int ll_stat; /* assorted switches */
#define LLOGNIL 0x00
#define LLOGCLS 0x01 /* keep log closed, except when writing */
#define LLOGCRT 0x02 /* create log if necessary */
#define LLOGZER 0x04 /* truncate log when limits reached */
#define LLOGERR 0x08 /* log closed due to (soft) error */
#define LLOGTTY 0x10 /* also log to stderr */
#define LLOGHDR 0x20 /* static header allocated */
#define LLOGDHR 0x40 /* dynamic header allocated */
int ll_fd; /* file descriptor */
} LLog;
/* */
#define SLOG(lp,event,what,args) \
if (lp -> ll_events & (event)) { \
(void) ll_log (lp, event, what, "%s", ll_preset args); \
} \
else
#ifndef LLOG
#define LLOG(lp,event,args) SLOG (lp, event, NULLCP, args)
#endif
#ifdef DEBUG
#define DLOG(lp,event,args) SLOG (lp, event, NULLCP, args)
#else
#define DLOG(lp,event,args)
#endif
#ifdef DEBUG
#ifdef PEPSY_VERSION
#ifdef __STDC__
#define PLOGP(lp,args,pe,text,rw) \
if ((lp) -> ll_events & LLOG_PDUS) { \
pvpdu (lp, print_##args##_P, pe, text, rw); \
} \
else
#define PLOG(lp,fnx,pe,text,rw) \
if ((lp) -> ll_events & LLOG_PDUS) { \
pvpdu (lp, fnx##_P, pe, text, rw); \
} \
else
#else
#define PLOGP(lp,args,pe,text,rw) \
if ((lp) -> ll_events & LLOG_PDUS) { \
pvpdu (lp, print_/* */args/* */_P, pe, text, rw); \
} \
else
#define PLOG(lp,fnx,pe,text,rw) \
if ((lp) -> ll_events & LLOG_PDUS) { \
pvpdu (lp, fnx/* */_P, pe, text, rw); \
} \
else
#endif
#else /* !PEPSY_VERSION */
#define PLOG(lp,fnx,pe,text,rw) \
if ((lp) -> ll_events & LLOG_PDUS) { \
vpdu (lp, fnx, pe, text, rw); \
} \
else
#endif /* !PEPSY_VERSION */
#ifdef lint
#undef PLOGP
#define pvpdu(lp,cookie,pe,text,rw) \
_pvpdu(lp, pe, text, rw)
#define PLOGP(lp,args,pe,text,rw) \
_pvpdu (lp, pe, text, rw);
#endif
#ifndef PLOGP
#define PLOGP(lp,args,pe,text,rw) \
if ((lp) -> ll_events & LLOG_PDUS) { \
pvpdu (lp, 0, (struct modtype *) 0, pe, text, rw); \
} \
else
#endif
#else /* !DEBUG */
#define PLOG(lp,fnx,pe,text,rw)
#define PLOGP(lp,args,pe,text,rw)
#endif
int ll_open ();
int ll_log (), _ll_log ();
int ll_close ();
void ll_hdinit ();
void ll_dbinit ();
int ll_printf ();
int ll_sync ();
char *ll_preset ();
int ll_check ();
int ll_defmhdr ();
IFP ll_setmhdr ();
#endif
|