rpm  4.16.1.2
Macros | Typedefs | Enumerations | Functions
rpmlog.h File Reference

Yet Another syslog(3) API clone. More...

#include <stdarg.h>
#include <stdio.h>
#include <rpm/rpmutil.h>
Include dependency graph for rpmlog.h:

Go to the source code of this file.

Macros

#define RPMLOG_PRIMASK   0x07 /* mask to extract priority part (internal) */
 
#define RPMLOG_PRI(p)   ((p) & RPMLOG_PRIMASK)
 
#define RPMLOG_MAKEPRI(fac, pri)   ((((unsigned)(fac)) << 3) | (pri))
 
#define RPMLOG_NFACILITIES   24
 
#define RPMLOG_FACMASK   0x03f8
 
#define RPMLOG_FAC(p)   (((p) & RPMLOG_FACMASK) >> 3)
 
#define RPMLOG_MASK(pri)   (1 << ((unsigned)(pri)))
 
#define RPMLOG_UPTO(pri)   ((1 << (((unsigned)(pri))+1)) - 1)
 
#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
 Option flags for callback return value. More...
 
#define RPMLOG_EXIT   0x02
 
#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 ))
 

Typedefs

typedef enum rpmlogLvl_e rpmlogLvl
 RPM Log levels. More...
 
typedef enum rpmlogFac_e rpmlogFac
 facility codes More...
 
typedef struct rpmlogRec_s * rpmlogRec
 
typedef void * rpmlogCallbackData
 
typedef int(* rpmlogCallback) (rpmlogRec rec, rpmlogCallbackData data)
 

Enumerations

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
}
 RPM Log levels. More...
 
enum  rpmlogFac_e {
  RPMLOG_KERN = (0<<3), RPMLOG_USER = (1<<3), RPMLOG_MAIL = (2<<3), RPMLOG_DAEMON = (3<<3),
  RPMLOG_AUTH = (4<<3), RPMLOG_SYSLOG = (5<<3), RPMLOG_LPR = (6<<3), RPMLOG_NEWS = (7<<3),
  RPMLOG_UUCP = (8<<3), RPMLOG_CRON = (9<<3), RPMLOG_AUTHPRIV = (10<<3), RPMLOG_FTP = (11<<3),
  RPMLOG_LOCAL0 = (16<<3), RPMLOG_LOCAL1 = (17<<3), RPMLOG_LOCAL2 = (18<<3), RPMLOG_LOCAL3 = (19<<3),
  RPMLOG_LOCAL4 = (20<<3), RPMLOG_LOCAL5 = (21<<3), RPMLOG_LOCAL6 = (22<<3), RPMLOG_LOCAL7 = (23<<3),
  RPMLOG_ERRMSG = (((unsigned)( 24 +0))<<3)
}
 facility codes More...
 

Functions

const char * rpmlogRecMessage (rpmlogRec rec)
 Retrieve log message string from rpmlog record. More...
 
rpmlogLvl rpmlogRecPriority (rpmlogRec rec)
 Retrieve log priority from rpmlog record. More...
 
int rpmlogGetNrecs (void)
 Return number of rpmError() ressages. More...
 
void rpmlogPrint (FILE *f)
 Print all rpmError() messages. More...
 
void rpmlogClose (void)
 Close desriptor used to write to system logger. More...
 
void rpmlogOpen (const char *ident, int option, int facility)
 Open connection to system logger. More...
 
int rpmlogSetMask (int mask)
 Set the log mask level. More...
 
void rpmlog (int code, const char *fmt,...) RPM_GNUC_PRINTF(2
 Generate a log message using FMT string and option arguments. More...
 
void const char * rpmlogMessage (void)
 Return text of last rpmError() message. More...
 
int rpmlogCode (void)
 Return error code from last rpmError() message. More...
 
const char * rpmlogLevelPrefix (rpmlogLvl pri)
 Return translated prefix string (if any) given log level. More...
 
rpmlogCallback rpmlogSetCallback (rpmlogCallback cb, rpmlogCallbackData data)
 Set rpmlog callback function. More...
 
FILE * rpmlogSetFile (FILE *fp)
 Set rpmlog file handle. More...
 

Detailed Description

Yet Another syslog(3) API clone.

Used to unify rpmError() and rpmMessage() interfaces in rpm.

Definition in file rpmlog.h.

Macro Definition Documentation

◆ rpmDecreaseVerbosity

#define rpmDecreaseVerbosity ( )     ((void)rpmlogSetMask((((int)(rpmlogSetMask(0) & 0xff)) >> 1)))

Definition at line 212 of file rpmlog.h.

◆ rpmIncreaseVerbosity

#define rpmIncreaseVerbosity ( )     ((void)rpmlogSetMask(((((unsigned)(rpmlogSetMask(0) & 0xff)) << 1) | 1)))

Definition at line 210 of file rpmlog.h.

◆ rpmIsDebug

#define rpmIsDebug ( )     (rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_DEBUG ))

Definition at line 218 of file rpmlog.h.

◆ rpmIsNormal

#define rpmIsNormal ( )     (rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_NOTICE ))

Definition at line 214 of file rpmlog.h.

◆ rpmIsVerbose

#define rpmIsVerbose ( )     (rpmlogSetMask(0) >= RPMLOG_MASK( RPMLOG_INFO ))

Definition at line 216 of file rpmlog.h.

◆ RPMLOG_CONS

#define RPMLOG_CONS   0x02

log on the console if errors in sending

Definition at line 93 of file rpmlog.h.

◆ RPMLOG_EXIT

#define RPMLOG_EXIT   0x02

exit after logging

Definition at line 103 of file rpmlog.h.

◆ RPMLOG_FAC

#define RPMLOG_FAC (   p)    (((p) & RPMLOG_FACMASK) >> 3)

Definition at line 77 of file rpmlog.h.

◆ RPMLOG_FACMASK

#define RPMLOG_FACMASK   0x03f8

mask to extract facility part

Definition at line 76 of file rpmlog.h.

◆ RPMLOG_MAKEPRI

#define RPMLOG_MAKEPRI (   fac,
  pri 
)    ((((unsigned)(fac)) << 3) | (pri))

Definition at line 43 of file rpmlog.h.

◆ RPMLOG_MASK

#define RPMLOG_MASK (   pri)    (1 << ((unsigned)(pri)))

mask for one priority

Definition at line 83 of file rpmlog.h.

◆ RPMLOG_NDELAY

#define RPMLOG_NDELAY   0x08

don't delay open

Definition at line 95 of file rpmlog.h.

◆ RPMLOG_NFACILITIES

#define RPMLOG_NFACILITIES   24

current number of facilities

Definition at line 72 of file rpmlog.h.

◆ RPMLOG_NOWAIT

#define RPMLOG_NOWAIT   0x10

don't wait for console forks: DEPRECATED

Definition at line 96 of file rpmlog.h.

◆ RPMLOG_ODELAY

#define RPMLOG_ODELAY   0x04

delay open until first syslog() (default)

Definition at line 94 of file rpmlog.h.

◆ RPMLOG_PERROR

#define RPMLOG_PERROR   0x20

log to stderr as well

Definition at line 97 of file rpmlog.h.

◆ RPMLOG_PID

#define RPMLOG_PID   0x01

log the pid with each message

Definition at line 92 of file rpmlog.h.

◆ RPMLOG_PRI

#define RPMLOG_PRI (   p)    ((p) & RPMLOG_PRIMASK)

Definition at line 42 of file rpmlog.h.

◆ RPMLOG_PRIMASK

#define RPMLOG_PRIMASK   0x07 /* mask to extract priority part (internal) */

Definition at line 40 of file rpmlog.h.

◆ RPMLOG_UPTO

#define RPMLOG_UPTO (   pri)    ((1 << (((unsigned)(pri))+1)) - 1)

all priorities through pri

Definition at line 84 of file rpmlog.h.

◆ rpmSetVerbosity

#define rpmSetVerbosity (   _lvl)     ((void)rpmlogSetMask( RPMLOG_UPTO( RPMLOG_PRI(_lvl))))

Definition at line 208 of file rpmlog.h.

Typedef Documentation

◆ rpmlogCallbackData

typedef void* rpmlogCallbackData

Definition at line 123 of file rpmlog.h.