13 #include <rpm/rpmutil.h>
40 #define RPMLOG_PRIMASK 0x07
42 #define RPMLOG_PRI(p) ((p) & RPMLOG_PRIMASK)
43 #define RPMLOG_MAKEPRI(fac, pri) ((((unsigned)(fac)) << 3) | (pri))
46 #define _RPMLOG_NOPRI 0x10
48 #define _RPMLOG_MARK RPMLOG_MAKEPRI(RPMLOG_NFACILITIES, 0)
49 typedef struct _rpmcode {
54 RPMCODE rpmprioritynames[] =
63 {
"none", _RPMLOG_NOPRI },
99 #define RPMLOG_NFACILITIES 24
100 RPMLOG_ERRMSG = (((unsigned)(RPMLOG_NFACILITIES+0))<<3)
103 #define RPMLOG_FACMASK 0x03f8
104 #define RPMLOG_FAC(p) (((p) & RPMLOG_FACMASK) >> 3)
108 RPMCODE facilitynames[] =
118 {
"mark", _RPMLOG_MARK },
139 #define RPMLOG_MASK(pri) (1 << ((unsigned)(pri)))
140 #define RPMLOG_UPTO(pri) ((1 << (((unsigned)(pri))+1)) - 1)
148 #define RPMLOG_PID 0x01
149 #define RPMLOG_CONS 0x02
150 #define RPMLOG_ODELAY 0x04
151 #define RPMLOG_NDELAY 0x08
152 #define RPMLOG_NOWAIT 0x10
153 #define RPMLOG_PERROR 0x20
158 #define RPMLOG_DEFAULT 0x01
159 #define RPMLOG_EXIT 0x02
163 typedef struct rpmlogRec_s * rpmlogRec;
213 void rpmlogOpen (
const char * ident,
int option,
int facility);
264 #define rpmSetVerbosity(_lvl) \
265 ((void)rpmlogSetMask( RPMLOG_UPTO( RPMLOG_PRI(_lvl))))
266 #define rpmIncreaseVerbosity() \
267 ((void)rpmlogSetMask(((((unsigned)(rpmlogSetMask(0) & 0xff)) << 1) | 1)))
268 #define rpmDecreaseVerbosity() \
269 ((void)rpmlogSetMask((((int)(rpmlogSetMask(0) & 0xff)) >> 1)))
270 #define rpmIsNormal() \
271 (rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_NOTICE ))
272 #define rpmIsVerbose() \
273 (rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_INFO ))
274 #define rpmIsDebug() \
275 (rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_DEBUG ))
const char * rpmlogLevelPrefix(rpmlogLvl pri)
Return translated prefix string (if any) given log level.
FILE * rpmlogSetFile(FILE *fp)
Set rpmlog file handle.
void * rpmlogCallbackData
enum rpmlogFac_e rpmlogFac
facility codes
struct rpmlogRec_s * rpmlogRec
void rpmlogClose(void)
Close desriptor used to write to system logger.
void const char * rpmlogMessage(void)
Return text of last rpmError() message.
int rpmlogSetMask(int mask)
Set the log mask level.
int(* rpmlogCallback)(rpmlogRec rec, rpmlogCallbackData data)
rpmlogLvl rpmlogRecPriority(rpmlogRec rec)
Retrieve log priority from rpmlog record.
void rpmlogOpen(const char *ident, int option, int facility)
Open connection to system logger.
#define RPM_GNUC_PRINTF(format_idx, arg_idx)
void rpmlog(int code, const char *fmt,...) RPM_GNUC_PRINTF(2
Generate a log message using FMT string and option arguments.
rpmlogCallback rpmlogSetCallback(rpmlogCallback cb, rpmlogCallbackData data)
Set rpmlog callback function.
int rpmlogCode(void)
Return error code from last rpmError() message.
enum rpmlogLvl_e rpmlogLvl
RPM Log levels.
void rpmlogPrint(FILE *f)
Print all rpmError() messages.
rpmlogFac_e
facility codes
const char * rpmlogRecMessage(rpmlogRec rec)
Retrieve log message string from rpmlog record.
rpmlogLvl_e
RPM Log levels.
int rpmlogGetNrecs(void)
Return number of rpmError() ressages.