Yet Another syslog(3) API clone. More...
#include <stdarg.h>
Go to the source code of this file.
Defines | |
#define | RPMLOG_PRIMASK 0x07 |
#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. | |
#define | RPMLOG_EXIT 0x02 |
Typedefs | |
typedef enum rpmlogLvl_e | rpmlogLvl |
RPM Log levels. | |
typedef enum rpmlogFac_e | rpmlogFac |
facility codes | |
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) } |
facility codes More... | |
Functions | |
const char * | rpmlogLevelPrefix (rpmlogLvl pri) |
Return translated prefix string (if any) given log level. | |
rpmlogCallback | rpmlogSetCallback (rpmlogCallback cb, rpmlogCallbackData data) |
Set rpmlog callback function. | |
void | rpmlogGetCallback (rpmlogCallback *cb, rpmlogCallbackData *data) |
Get rpmlog callback function and data. | |
int | rpmlogGetNrecs (void) |
Return number of messages. | |
const char * | rpmlogRecMessage (rpmlogRec rec) |
Retrieve log message string from rpmlog record. | |
rpmlogLvl | rpmlogRecPriority (rpmlogRec rec) |
Retrieve log priority from rpmlog record. | |
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. | |
void | _rpmlog (int code, const char *fmt,...) |
Generate a log message using FMT string and option arguments. | |
void | vrpmlog (unsigned code, const char *fmt, va_list ap) |
Same as _rpmlog with stdarg argument list. | |
static void | rpmlog (int code, const char *fmt,...) |
const char * | rpmlogMessage (void) |
Return text of last rpmError() message. | |
int | rpmlogCode (void) |
Return error code from last rpmError() message. | |
FILE * | rpmlogSetFile (FILE *fp) |
Set rpmlog file handle. |
Yet Another syslog(3) API clone.
Definition in file rpmlog.h.
#define RPMLOG_CONS 0x02 |
#define RPMLOG_DEFAULT 0x01 |
#define RPMLOG_EXIT 0x02 |
exit after logging
Definition at line 174 of file rpmlog.h.
Referenced by rpmlogDefault(), and vrpmlog().
#define RPMLOG_FAC | ( | p ) | (((p) & RPMLOG_FACMASK) >> 3) |
#define RPMLOG_MAKEPRI | ( | fac, | |
pri | |||
) | ((((unsigned)(fac)) << 3) | (pri)) |
#define RPMLOG_MASK | ( | pri ) | (1 << ((unsigned)(pri))) |
#define RPMLOG_NOWAIT 0x10 |
#define RPMLOG_ODELAY 0x04 |
#define RPMLOG_PRI | ( | p ) | ((p) & RPMLOG_PRIMASK) |
#define RPMLOG_UPTO | ( | pri ) | ((1 << (((unsigned)(pri))+1)) - 1) |
typedef int(* rpmlogCallback)(rpmlogRec rec, rpmlogCallbackData data) |
typedef void* rpmlogCallbackData |
typedef enum rpmlogFac_e rpmlogFac |
facility codes
typedef enum rpmlogLvl_e rpmlogLvl |
RPM Log levels.
priorities/facilities are encoded into a single 32-bit quantity, where the bottom 3 bits are the priority (0-7) and the top 28 bits are the facility (0-big number). Both the priorities and the facilities map roughly one-to-one to strings in the syslogd(8) source code. This mapping is included in this file.
priorities (these are ordered)
enum rpmlogFac_e |
facility codes
enum rpmlogLvl_e |
RPM Log levels.
priorities/facilities are encoded into a single 32-bit quantity, where the bottom 3 bits are the priority (0-7) and the top 28 bits are the facility (0-big number). Both the priorities and the facilities map roughly one-to-one to strings in the syslogd(8) source code. This mapping is included in this file.
priorities (these are ordered)
void _rpmlog | ( | int | code, |
const char * | fmt, | ||
... | |||
) |
static void rpmlog | ( | int | code, |
const char * | fmt, | ||
... | |||
) | [inline, static] |
< mask for one priority
Definition at line 298 of file rpmlog.h.
References RPMLOG_MASK, RPMLOG_PRI, rpmlogSetMask(), and vrpmlog().
Referenced by _specQuery(), addChangelog(), addFile(), addFileToTagAux(), addMacro(), addSource(), buildHost(), buildSpec(), cacheStashLatest(), checkForDuplicates(), checkForRequired(), checkForValidArchitectures(), checkOwners(), checkUnpackagedFiles(), copyFile(), copyNextLineFromOFI(), cpio_copy(), cpio_doio(), createDir(), cvtdberr(), db3close(), db3open(), db_fini(), db_init(), dbiFindMatches(), dbiOpen(), dnlInitIterator(), doAddSubtract(), doDefine(), doFoo(), doIcon(), doLogical(), doMultiplyDivide(), doOutput(), doPatch(), doPatchMacro(), doPrimary(), doRelational(), doSetupMacro(), doUndefine(), doUntar(), expandMacro(), expandMacros(), fiIntersect(), findErases(), findPreambleTag(), flushBuffer(), freeArgs(), fsmMapAttrs(), fsmMkdirs(), fsmStage(), genCpioListAndHeader(), getFilesystemList(), getGidS(), getGname(), getGnameS(), getOutputFrom(), getUidS(), getUname(), getUnameS(), grabArgs(), handlePreambleTag(), headerCheck(), IDTXglob(), ignoreDep(), initGlobs(), installArgCallback(), iosmMapAttrs(), iosmMkdirs(), iosmStage(), isCompressed(), makeGPGSignature(), makeHDRSignature(), manageFile(), miFreeHeader(), mireRegcomp(), mireRegexec(), mireStudy(), packageBinaries(), parseBuildInstallClean(), parseDescription(), parseExpressionBoolean(), parseExpressionString(), parseFiles(), parseForAttr(), parseForConfig(), parseForDev(), parseForLang(), parseForSimple(), parseForVerify(), parseNoSource(), parsePreamble(), parsePrep(), parseRCPOT(), parseScript(), parseSpec(), pkgUnpackagedSubdirs(), prepFetch(), prepFetchVerbose(), printDeps(), printNewSpecfile(), printSize(), processBinaryFile(), processBinaryFiles(), processMetadataFile(), processPackageFiles(), processScriptFiles(), processSourceFiles(), psmWait(), queryHeader(), rdToken(), readFile(), readLine(), readLineFromOFI(), relocateFileList(), rpmCheckPassPhrase(), rpmcliImportPubkeys(), rpmcliInit(), rpmcliInstall(), rpmcliInstallProblems(), rpmcliInstallSuggests(), rpmcliSign(), rpmdbAdd(), rpmdbCheckSignals(), rpmdbCount(), rpmdbExportInfo(), rpmdbFindByFile(), rpmdbGrowIterator(), rpmdbMireApply(), rpmdbMoveDatabase(), rpmdbNew(), rpmdbRebuild(), rpmdbRemove(), rpmdsNotify(), rpmErase(), rpmfcApply(), rpmfcClassify(), rpmfcExpandRegexps(), rpmfcGenerateDependsHelper(), rpmfcMatchRegexps(), rpmfiDecideFate(), rpmGetFilesystemUsage(), rpmgiInitFilter(), rpmgiNext(), rpmgiOpen(), rpmgiWalkPathFilter(), rpmInitMacros(), rpmInstallSource(), rpmInstallSourcePackage(), rpmioAllArgCallback(), rpmioFreePool(), rpmioInit(), rpmioMkpath(), rpmioNewPool(), rpmmgBuffer(), rpmmgFile(), rpmmgNew(), rpmmiInit(), rpmmiNext(), rpmMkdirPath(), rpmpsmStage(), rpmQueryVerify(), rpmReadHeaders(), rpmReadPackageFile(), rpmReadPackageManifest(), rpmReSign(), rpmRollback(), rpmShowProgress(), rpmSingleHeaderFromFD(), rpmspecQuery(), rpmTempFile(), rpmts_Die(), rpmtsAddInstallElement(), rpmtsAddObsoletes(), rpmtsAddUpgrades(), rpmtsCheck(), rpmtsEraseDebuginfo(), rpmtsFindPubkey(), rpmtsInitDSI(), rpmtsInitIterator(), rpmtsOpenDB(), rpmtsOpenSDB(), rpmtsOrder(), rpmtsRollback(), rpmtsRun(), rpmtsSolve(), rpmuuidMake(), rpmVerifySignatures(), rpmWriteHeaders(), runScript(), scpReset(), showQueryPackage(), skipFiles(), sql_busy_handler(), sql_byteswapped(), sql_cdel(), sql_cget(), sql_close(), sql_cput(), sql_initDB(), sql_open(), sql_stat(), tagValidate(), timeCheck(), urlConnect(), urlGetFile(), urlSplit(), verifyDependencies(), verifyHeader(), writeRPM(), wrSignature(), and zapRelation().
void rpmlogClose | ( | void | ) |
int rpmlogCode | ( | void | ) |
Return error code from last rpmError() message.
void rpmlogGetCallback | ( | rpmlogCallback * | cb, |
rpmlogCallbackData * | data | ||
) |
Get rpmlog callback function and data.
cb | pointer to rpmlog callback function |
data | pointer to callback private (user) data |
Definition at line 133 of file rpmlog.c.
References _rpmlogCallback, and _rpmlogCallbackData.
int rpmlogGetNrecs | ( | void | ) |
Return number of messages.
Definition at line 30 of file rpmlog.c.
References nrecs.
Referenced by buildSpec().
const char* rpmlogLevelPrefix | ( | rpmlogLvl | pri ) |
Return translated prefix string (if any) given log level.
pri | log priority |
Definition at line 197 of file rpmlog.c.
References rpmlogMsgPrefix.
Referenced by rpmlogDefault().
const char* rpmlogMessage | ( | void | ) |
void rpmlogOpen | ( | const char * | ident, |
int | option, | ||
int | facility | ||
) |
void rpmlogPrint | ( | FILE * | f ) |
Print all rpmError() messages.
f | file handle (NULL uses stderr) |
Definition at line 62 of file rpmlog.c.
Referenced by buildSpec().
const char* rpmlogRecMessage | ( | rpmlogRec | rec ) |
rpmlogCallback rpmlogSetCallback | ( | rpmlogCallback | cb, |
rpmlogCallbackData | data | ||
) |
Set rpmlog callback function.
cb | rpmlog callback function |
data | callback private (user) data |
Definition at line 123 of file rpmlog.c.
References _rpmlogCallback, and _rpmlogCallbackData.
FILE* rpmlogSetFile | ( | FILE * | fp ) |
Set rpmlog file handle.
fp | rpmlog file handle (NULL uses stdout/stderr) |
Definition at line 174 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 107 of file rpmlog.c.
References rpmlogMask.
void vrpmlog | ( | unsigned | code, |
const char * | fmt, | ||
va_list | ap | ||
) |
Same as _rpmlog with stdarg argument list.
Definition at line 213 of file rpmlog.c.
References _free(), _rpmlogCallback, _rpmlogCallbackData, EXIT_FAILURE, nrecs, recs, RPMLOG_DEFAULT, RPMLOG_EXIT, RPMLOG_FAC, RPMLOG_MASK, RPMLOG_PRI, RPMLOG_WARNING, rpmlogDefault(), rpmlogMask, vsnprintf(), xmalloc(), xrealloc(), and xstrdup().