rpm 4.19.92
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
10#include <stdarg.h>
11#include <stdio.h>
12
13#include <rpm/rpmutil.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
24typedef enum rpmlogLvl_e {
32 RPMLOG_DEBUG = 7
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
68typedef struct rpmlogRec_s * rpmlogRec;
69
75const char * rpmlogRecMessage(rpmlogRec rec);
76
83
84typedef void * rpmlogCallbackData;
85
94typedef int (*rpmlogCallback) (rpmlogRec rec, rpmlogCallbackData data);
95
101int rpmlogGetNrecsByMask(unsigned mask);
102
107int rpmlogGetNrecs(void) ;
108
114void rpmlogPrintByMask(FILE *f, unsigned mask);
115
120void rpmlogPrint(FILE *f);
121
126void rpmlogClose (void);
127
132void rpmlogOpen (const char * ident, int option, int facility);
133
139int rpmlogSetMask (int mask);
140
144void rpmlog (int code, const char *fmt, ...) RPM_GNUC_PRINTF(2, 3);
145
150const char * rpmlogMessage(void);
151
159int rpmlogCode(void);
160
166const char * rpmlogLevelPrefix(rpmlogLvl pri);
167
175
181FILE * 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 */
int rpmlogGetNrecs(void)
int rpmlogSetMask(int mask)
int rpmlogGetNrecsByMask(unsigned mask)
void rpmlogOpen(const char *ident, int option, int facility)
const char * rpmlogRecMessage(rpmlogRec rec)
void rpmlogPrint(FILE *f)
enum rpmlogLvl_e rpmlogLvl
int(* rpmlogCallback)(rpmlogRec rec, rpmlogCallbackData data)
Definition rpmlog.h:94
void rpmlog(int code, const char *fmt,...) RPM_GNUC_PRINTF(2
rpmlogCallback rpmlogSetCallback(rpmlogCallback cb, rpmlogCallbackData data)
void rpmlogClose(void)
rpmlogLvl rpmlogRecPriority(rpmlogRec rec)
rpmlogLvl_e
Definition rpmlog.h:24
int rpmlogCode(void)
FILE * rpmlogSetFile(FILE *fp)
void const char * rpmlogMessage(void)
const char * rpmlogLevelPrefix(rpmlogLvl pri)
void rpmlogPrintByMask(FILE *f, unsigned mask)
@ 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