rpm
6.0.1
The RPM Package Manager
Toggle main menu visibility
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
16
extern
"C"
{
17
#endif
18
24
typedef
enum
rpmlogLvl_e
{
25
RPMLOG_EMERG
= 0,
26
RPMLOG_ALERT
= 1,
27
RPMLOG_CRIT
= 2,
28
RPMLOG_ERR
= 3,
29
RPMLOG_WARNING
= 4,
30
RPMLOG_NOTICE
= 5,
31
RPMLOG_INFO
= 6,
32
RPMLOG_DEBUG
= 7
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)
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
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 */
rpmlogGetNrecs
int rpmlogGetNrecs(void)
rpmlogSetMask
int rpmlogSetMask(int mask)
rpmlogGetNrecsByMask
int rpmlogGetNrecsByMask(unsigned mask)
rpmlogOpen
void rpmlogOpen(const char *ident, int option, int facility)
rpmlogRecMessage
const char * rpmlogRecMessage(rpmlogRec rec)
rpmlogPrint
void rpmlogPrint(FILE *f)
rpmlogLvl
enum rpmlogLvl_e rpmlogLvl
rpmlogCallback
int(* rpmlogCallback)(rpmlogRec rec, rpmlogCallbackData data)
Definition
rpmlog.h:94
rpmlog
void rpmlog(int code, const char *fmt,...) RPM_GNUC_PRINTF(2
rpmlogSetCallback
rpmlogCallback rpmlogSetCallback(rpmlogCallback cb, rpmlogCallbackData data)
rpmlogClose
void rpmlogClose(void)
rpmlogRecPriority
rpmlogLvl rpmlogRecPriority(rpmlogRec rec)
rpmlogLvl_e
rpmlogLvl_e
Definition
rpmlog.h:24
rpmlogCode
int rpmlogCode(void)
rpmlogSetFile
FILE * rpmlogSetFile(FILE *fp)
rpmlogMessage
void const char * rpmlogMessage(void)
rpmlogLevelPrefix
const char * rpmlogLevelPrefix(rpmlogLvl pri)
rpmlogPrintByMask
void rpmlogPrintByMask(FILE *f, unsigned mask)
RPMLOG_DEBUG
@ RPMLOG_DEBUG
Definition
rpmlog.h:32
RPMLOG_ERR
@ RPMLOG_ERR
Definition
rpmlog.h:28
RPMLOG_WARNING
@ RPMLOG_WARNING
Definition
rpmlog.h:29
RPMLOG_NOTICE
@ RPMLOG_NOTICE
Definition
rpmlog.h:30
RPMLOG_INFO
@ RPMLOG_INFO
Definition
rpmlog.h:31
RPMLOG_CRIT
@ RPMLOG_CRIT
Definition
rpmlog.h:27
RPMLOG_EMERG
@ RPMLOG_EMERG
Definition
rpmlog.h:25
RPMLOG_ALERT
@ RPMLOG_ALERT
Definition
rpmlog.h:26
rpmutil.h
include
rpm
rpmlog.h
Generated by
1.17.0