rpm  6.0.91
The RPM Package Manager
rpmlog.h
Go to the documentation of this file.
1 #ifndef H_RPMLOG
2 #define H_RPMLOG 1
3 
10 #include <stdarg.h>
11 #include <stdio.h>
12 
13 #include <rpm/rpmutil.h>
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
24 typedef enum rpmlogLvl_e {
28  RPMLOG_ERR = 3,
33 } rpmlogLvl;
34 
35 #define RPMLOG_PRIMASK 0x07 /* mask to extract priority part (internal) */
36  /* extract priority */
37 #define RPMLOG_PRI(p) ((p) & RPMLOG_PRIMASK)
38 #define RPMLOG_MAKEPRI(fac, pri) ((((unsigned)(fac)) << 3) | (pri))
39 #define RPMLOG_NPRIS (RPMLOG_DEBUG + 1)
40 
41 /*
42  * arguments to setlogmask.
43  */
44 #define RPMLOG_MASK(pri) (1 << ((unsigned)(pri)))
45 #define RPMLOG_UPTO(pri) ((1 << (((unsigned)(pri))+1)) - 1)
47 /*
48  * Option flags for openlog.
49  *
50  * RPMLOG_ODELAY no longer does anything.
51  * RPMLOG_NDELAY is the inverse of what it used to be.
52  */
53 #define RPMLOG_PID 0x01
54 #define RPMLOG_CONS 0x02
55 #define RPMLOG_ODELAY 0x04
56 #define RPMLOG_NDELAY 0x08
57 #define RPMLOG_NOWAIT 0x10
58 #define RPMLOG_PERROR 0x20
63 #define RPMLOG_DEFAULT 0x01
64 #define RPMLOG_EXIT 0x02
68 typedef struct rpmlogRec_s * rpmlogRec;
69 
75 const char * rpmlogRecMessage(rpmlogRec rec);
76 
82 rpmlogLvl rpmlogRecPriority(rpmlogRec rec);
83 
84 typedef void * rpmlogCallbackData;
85 
94 typedef int (*rpmlogCallback) (rpmlogRec rec, rpmlogCallbackData data);
95 
101 int rpmlogGetNrecsByMask(unsigned mask);
102 
107 int rpmlogGetNrecs(void) ;
108 
114 void rpmlogPrintByMask(FILE *f, unsigned mask);
115 
120 void rpmlogPrint(FILE *f);
121 
126 void rpmlogClose (void);
127 
132 void rpmlogOpen (const char * ident, int option, int facility);
133 
139 int rpmlogSetMask (int mask);
140 
144 void rpmlog (int code, const char *fmt, ...) RPM_GNUC_PRINTF(2, 3);
145 
150 const char * rpmlogMessage(void);
151 
159 int rpmlogCode(void);
160 
166 const char * rpmlogLevelPrefix(rpmlogLvl pri);
167 
174 rpmlogCallback rpmlogSetCallback(rpmlogCallback cb, rpmlogCallbackData data);
175 
181 FILE * rpmlogSetFile(FILE * fp);
182 
183 #define rpmSetVerbosity(_lvl) \
184  ((void)rpmlogSetMask( RPMLOG_UPTO( RPMLOG_PRI(_lvl))))
185 #define rpmIncreaseVerbosity() \
186  ((void)rpmlogSetMask(((((unsigned)(rpmlogSetMask(0) & 0xff)) << 1) | 1)))
187 #define rpmDecreaseVerbosity() \
188  ((void)rpmlogSetMask((((int)(rpmlogSetMask(0) & 0xff)) >> 1)))
189 #define rpmIsNormal() \
190  (rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_NOTICE ))
191 #define rpmIsVerbose() \
192  (rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_INFO ))
193 #define rpmIsDebug() \
194  (rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_DEBUG ))
195 
196 #ifdef __cplusplus
197 }
198 #endif
199 
200 #endif /* H_RPMLOG */
const char * rpmlogLevelPrefix(rpmlogLvl pri)
FILE * rpmlogSetFile(FILE *fp)
Definition: rpmlog.h:28
Definition: rpmlog.h:27
void rpmlogClose(void)
void const char * rpmlogMessage(void)
Definition: rpmlog.h:31
int(* rpmlogCallback)(rpmlogRec rec, rpmlogCallbackData data)
Definition: rpmlog.h:94
int rpmlogSetMask(int mask)
Definition: rpmlog.h:32
rpmlogLvl rpmlogRecPriority(rpmlogRec rec)
Definition: rpmlog.h:29
void rpmlogPrintByMask(FILE *f, unsigned mask)
void rpmlogOpen(const char *ident, int option, int facility)
Definition: rpmlog.h:30
void rpmlog(int code, const char *fmt,...) RPM_GNUC_PRINTF(2
rpmlogCallback rpmlogSetCallback(rpmlogCallback cb, rpmlogCallbackData data)
int rpmlogCode(void)
enum rpmlogLvl_e rpmlogLvl
void rpmlogPrint(FILE *f)
Definition: rpmlog.h:25
const char * rpmlogRecMessage(rpmlogRec rec)
Definition: rpmlog.h:26
int rpmlogGetNrecsByMask(unsigned mask)
rpmlogLvl_e
Definition: rpmlog.h:24
int rpmlogGetNrecs(void)