rpm 6.1.90
The RPM Package Manager
Loading...
Searching...
No Matches
rpmlog.h
Go to the documentation of this file.
1#ifndef H_RPMLOG
2#define H_RPMLOG 1
3
9
10#include <stdarg.h>
11#include <stdio.h>
12
13#include <rpm/rpmutil.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
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)
46
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
59
63#define RPMLOG_DEFAULT 0x01
64#define RPMLOG_EXIT 0x02
65
68typedef struct rpmlogRec_s * rpmlogRec;
69
75RPM_PUBLIC_API
76const char * rpmlogRecMessage(rpmlogRec rec);
77
83RPM_PUBLIC_API
85
86typedef void * rpmlogCallbackData;
87
96typedef int (*rpmlogCallback) (rpmlogRec rec, rpmlogCallbackData data);
97
103RPM_PUBLIC_API
104int rpmlogGetNrecsByMask(unsigned mask);
105
110RPM_PUBLIC_API
111int rpmlogGetNrecs(void) ;
112
118RPM_PUBLIC_API
119void rpmlogPrintByMask(FILE *f, unsigned mask);
120
125RPM_PUBLIC_API
126void rpmlogPrint(FILE *f);
127
132RPM_PUBLIC_API
133void rpmlogClose (void);
134
139RPM_PUBLIC_API
140void rpmlogOpen (const char * ident, int option, int facility);
141
147RPM_PUBLIC_API
148int rpmlogSetMask (int mask);
149
153RPM_PUBLIC_API
154void rpmlog (int code, const char *fmt, ...) RPM_GNUC_PRINTF(2, 3);
155
160RPM_PUBLIC_API
161const char * rpmlogMessage(void);
162
170RPM_PUBLIC_API
171int rpmlogCode(void);
172
178RPM_PUBLIC_API
179const char * rpmlogLevelPrefix(rpmlogLvl pri);
180
187RPM_PUBLIC_API
189
195RPM_PUBLIC_API
196FILE * rpmlogSetFile(FILE * fp);
197
198#define rpmSetVerbosity(_lvl) \
199 ((void)rpmlogSetMask( RPMLOG_UPTO( RPMLOG_PRI(_lvl))))
200#define rpmIncreaseVerbosity() \
201 ((void)rpmlogSetMask(((((unsigned)(rpmlogSetMask(0) & 0xff)) << 1) | 1)))
202#define rpmDecreaseVerbosity() \
203 ((void)rpmlogSetMask((((int)(rpmlogSetMask(0) & 0xff)) >> 1)))
204#define rpmIsNormal() \
205 (rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_NOTICE ))
206#define rpmIsVerbose() \
207 (rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_INFO ))
208#define rpmIsDebug() \
209 (rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_DEBUG ))
210
211#ifdef __cplusplus
212}
213#endif
214
215#endif /* H_RPMLOG */
RPM_PUBLIC_API int rpmlogSetMask(int mask)
RPM_PUBLIC_API int rpmlogGetNrecsByMask(unsigned mask)
RPM_PUBLIC_API void rpmlogOpen(const char *ident, int option, int facility)
RPM_PUBLIC_API FILE * rpmlogSetFile(FILE *fp)
RPM_PUBLIC_API void rpmlogClose(void)
RPM_PUBLIC_API int rpmlogGetNrecs(void)
enum rpmlogLvl_e rpmlogLvl
int(* rpmlogCallback)(rpmlogRec rec, rpmlogCallbackData data)
Definition rpmlog.h:96
RPM_PUBLIC_API rpmlogCallback rpmlogSetCallback(rpmlogCallback cb, rpmlogCallbackData data)
RPM_PUBLIC_API void rpmlogPrint(FILE *f)
RPM_PUBLIC_API rpmlogLvl rpmlogRecPriority(rpmlogRec rec)
RPM_PUBLIC_API const char * rpmlogLevelPrefix(rpmlogLvl pri)
RPM_PUBLIC_API const char * rpmlogRecMessage(rpmlogRec rec)
RPM_PUBLIC_API void RPM_PUBLIC_API const char * rpmlogMessage(void)
RPM_PUBLIC_API void rpmlogPrintByMask(FILE *f, unsigned mask)
rpmlogLvl_e
Definition rpmlog.h:24
RPM_PUBLIC_API int rpmlogCode(void)
RPM_PUBLIC_API void rpmlog(int code, const char *fmt,...) RPM_GNUC_PRINTF(2
@ RPMLOG_DEBUG
Definition rpmlog.h:32
@ RPMLOG_ERR
Definition rpmlog.h:28
@ RPMLOG_WARNING
Definition rpmlog.h:29
@ RPMLOG_NOTICE
Definition rpmlog.h:30
@ RPMLOG_INFO
Definition rpmlog.h:31
@ RPMLOG_CRIT
Definition rpmlog.h:27
@ RPMLOG_EMERG
Definition rpmlog.h:25
@ RPMLOG_ALERT
Definition rpmlog.h:26