Loading...
Searching...
No Matches
rpmlog.h
Go to the documentation of this file.
#ifndef H_RPMLOG
#define H_RPMLOG 1
#include <stdarg.h>
#include <stdio.h>
#include <rpm/rpmutil.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum rpmlogLvl_e {
RPMLOG_EMERG = 0,
RPMLOG_ALERT = 1,
RPMLOG_CRIT = 2,
RPMLOG_ERR = 3,
RPMLOG_WARNING = 4,
RPMLOG_NOTICE = 5,
RPMLOG_INFO = 6,
RPMLOG_DEBUG = 7
} rpmlogLvl;
#define RPMLOG_PRIMASK 0x07 /* mask to extract priority part (internal) */
/* extract priority */
#define RPMLOG_PRI(p) ((p) & RPMLOG_PRIMASK)
#define RPMLOG_MAKEPRI(fac, pri) ((((unsigned)(fac)) << 3) | (pri))
#define RPMLOG_NPRIS (RPMLOG_DEBUG + 1)
/*
* arguments to setlogmask.
*/
#define RPMLOG_MASK(pri) (1 << ((unsigned)(pri)))
#define RPMLOG_UPTO(pri) ((1 << (((unsigned)(pri))+1)) - 1)
/*
* Option flags for openlog.
*
* RPMLOG_ODELAY no longer does anything.
* RPMLOG_NDELAY is the inverse of what it used to be.
*/
#define RPMLOG_PID 0x01
#define RPMLOG_CONS 0x02
#define RPMLOG_ODELAY 0x04
#define RPMLOG_NDELAY 0x08
#define RPMLOG_NOWAIT 0x10
#define RPMLOG_PERROR 0x20
#define RPMLOG_DEFAULT 0x01
#define RPMLOG_EXIT 0x02
typedef struct rpmlogRec_s * rpmlogRec;
const char * rpmlogRecMessage(rpmlogRec rec);
rpmlogLvl rpmlogRecPriority(rpmlogRec rec);
typedef void * rpmlogCallbackData;
typedef int (*rpmlogCallback) (rpmlogRec rec, rpmlogCallbackData data);
int rpmlogGetNrecsByMask(unsigned mask);
int rpmlogGetNrecs(void) ;
void rpmlogPrintByMask(FILE *f, unsigned mask);
void rpmlogPrint(FILE *f);
void rpmlogClose (void);
void rpmlogOpen (const char * ident, int option, int facility);
int rpmlogSetMask (int mask);
void rpmlog (int code, const char *fmt, ...) RPM_GNUC_PRINTF(2, 3);
const char * rpmlogMessage(void);
int rpmlogCode(void);
const char * rpmlogLevelPrefix(rpmlogLvl pri);
rpmlogCallback rpmlogSetCallback(rpmlogCallback cb, rpmlogCallbackData data);
FILE * rpmlogSetFile(FILE * fp);
#define rpmSetVerbosity(_lvl) \
((void)rpmlogSetMask( RPMLOG_UPTO( RPMLOG_PRI(_lvl))))
#define rpmIncreaseVerbosity() \
((void)rpmlogSetMask(((((unsigned)(rpmlogSetMask(0) & 0xff)) << 1) | 1)))
#define rpmDecreaseVerbosity() \
((void)rpmlogSetMask((((int)(rpmlogSetMask(0) & 0xff)) >> 1)))
#define rpmIsNormal() \
(rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_NOTICE ))
#define rpmIsVerbose() \
(rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_INFO ))
#define rpmIsDebug() \
(rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_DEBUG ))
#ifdef __cplusplus
}
#endif
#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