#include "system.h"
#include <stdarg.h>
#include "rpmlog.h"
#include "debug.h"
Go to the source code of this file.
Defines | |
#define | va_copy(DEST, SRC) ((DEST) = (SRC)) |
Functions | |
static void * | _free (const void *p) |
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL. | |
int | rpmlogGetNrecs (void) |
Return number of rpmError() ressages. | |
int | rpmlogCode (void) |
Return error code from last rpmError() message. | |
const char * | rpmlogMessage (void) |
Return text of last rpmError() message. | |
void | rpmlogPrint (FILE *f) |
Print all rpmError() messages. | |
void | rpmlogClose (void) |
Close desriptor used to write to system logger. | |
void | rpmlogOpen (const char *ident, int option, int facility) |
Open connection to system logger. | |
int | rpmlogSetMask (int mask) |
Set the log mask level. | |
rpmlogCallback | rpmlogSetCallback (rpmlogCallback cb) |
Set rpmlog callback function. | |
FILE * | rpmlogSetFile (FILE *fp) |
Set rpmlog file handle. | |
static int | vsnprintf (char *buf, int nb, const char *fmt, va_list ap) |
static void | vrpmlog (unsigned code, const char *fmt, va_list ap) |
void | rpmlog (int code, const char *fmt,...) |
Generate a log message using FMT string and option arguments. | |
int | rpmErrorCode (void) |
Return error code from last rpmError() message. | |
const char * | rpmErrorString (void) |
Return text of last rpmError() message. | |
rpmlogCallback | rpmErrorSetCallback (rpmlogCallback cb) |
Set rpmlog callback function. | |
Variables | |
static int | nrecs = 0 |
static rpmlogRec | recs = NULL |
static unsigned | rpmlogMask = ((1 << (((unsigned)( RPMLOG_NOTICE ))+1)) - 1) |
static unsigned | rpmlogFacility = RPMLOG_USER |
static rpmlogCallback | _rpmlogCallback = NULL |
static FILE * | _stdlog = NULL |
static char * | rpmlogMsgPrefix [] |
Definition in file rpmlog.c.
#define va_copy | ( | DEST, | |||
SRC | ) | ((DEST) = (SRC)) |
static void* _free | ( | const void * | p | ) | [inline, static] |
int rpmErrorCode | ( | void | ) |
Return error code from last rpmError() message.
Definition at line 266 of file rpmlog.c.
References rpmlogCode().
rpmlogCallback rpmErrorSetCallback | ( | rpmlogCallback | cb | ) |
Set rpmlog callback function.
Definition at line 276 of file rpmlog.c.
References rpmlogSetCallback().
const char* rpmErrorString | ( | void | ) |
Return text of last rpmError() message.
Definition at line 271 of file rpmlog.c.
References rpmlogMessage().
void rpmlog | ( | int | code, | |
const char * | fmt, | |||
... | ||||
) |
Generate a log message using FMT string and option arguments.
Definition at line 255 of file rpmlog.c.
References vrpmlog().
Referenced by getGidS(), getGname(), getGnameS(), getUidS(), getUname(), and getUnameS().
void rpmlogClose | ( | void | ) |
int rpmlogCode | ( | void | ) |
Return error code from last rpmError() message.
Definition at line 47 of file rpmlog.c.
References rpmlogRec_s::code, nrecs, and recs.
Referenced by rpmErrorCode().
int rpmlogGetNrecs | ( | void | ) |
Return number of rpmError() ressages.
Definition at line 42 of file rpmlog.c.
References nrecs.
const char* rpmlogMessage | ( | void | ) |
Return text of last rpmError() message.
Definition at line 55 of file rpmlog.c.
References _, rpmlogRec_s::message, nrecs, and recs.
Referenced by rpmErrorString().
void rpmlogOpen | ( | const char * | ident, | |
int | option, | |||
int | facility | |||
) |
void rpmlogPrint | ( | FILE * | f | ) |
Print all rpmError() messages.
f | file handle (NULL uses stderr) |
rpmlogCallback rpmlogSetCallback | ( | rpmlogCallback | cb | ) |
Set rpmlog callback function.
cb | rpmlog callback function |
Definition at line 118 of file rpmlog.c.
References _rpmlogCallback.
Referenced by rpmErrorSetCallback().
FILE* rpmlogSetFile | ( | FILE * | fp | ) |
Set rpmlog file handle.
fp | rpmlog file handle (NULL uses stdout/stderr) |
Definition at line 130 of file rpmlog.c.
References _stdlog.
Referenced by setLogFile().
int rpmlogSetMask | ( | int | mask | ) |
Set the log mask level.
mask | log mask (0 is no operation) |
Definition at line 105 of file rpmlog.c.
References rpmlogMask.
static void vrpmlog | ( | unsigned | code, | |
const char * | fmt, | |||
va_list | ap | |||
) | [static] |
< mask for one priority
< mask to extract facility part
Definition at line 164 of file rpmlog.c.
References _, _free(), _rpmlogCallback, _stdlog, EXIT_FAILURE, nrecs, recs, RPMLOG_ALERT, RPMLOG_CRIT, RPMLOG_DEBUG, RPMLOG_EMERG, RPMLOG_ERR, RPMLOG_FAC, RPMLOG_INFO, RPMLOG_MASK, RPMLOG_NOTICE, RPMLOG_PRI, RPMLOG_WARNING, rpmlogMask, rpmlogMsgPrefix, va_copy, vsnprintf(), xmalloc(), and xrealloc().
Referenced by rpmlog().
static int vsnprintf | ( | char * | buf, | |
int | nb, | |||
const char * | fmt, | |||
va_list | ap | |||
) | [inline, static] |
rpmlogCallback _rpmlogCallback = NULL [static] |
FILE* _stdlog = NULL [static] |
int nrecs = 0 [static] |
Definition at line 26 of file rpmlog.c.
Referenced by rpmlogClose(), rpmlogCode(), rpmlogGetNrecs(), rpmlogMessage(), rpmlogPrint(), and vrpmlog().
Definition at line 28 of file rpmlog.c.
Referenced by handleOverlappedFiles(), rpmlogClose(), rpmlogCode(), rpmlogMessage(), rpmlogPrint(), and vrpmlog().
unsigned rpmlogFacility = RPMLOG_USER [static] |
unsigned rpmlogMask = ((1 << (((unsigned)( RPMLOG_NOTICE ))+1)) - 1) [static] |
all priorities through pri
Definition at line 100 of file rpmlog.c.
Referenced by rpmlogSetMask(), and vrpmlog().
char* rpmlogMsgPrefix[] [static] |