rpm  5.4.14
Macros | Functions | Variables
rpmlog.c File Reference
#include "system.h"
#include <stdarg.h>
#include <rpmiotypes.h>
#include <rpmlog.h>
#include "debug.h"
Include dependency graph for rpmlog.c:

Go to the source code of this file.

Macros

#define _RPMLOG_INTERNAL
 

Functions

int rpmlogGetNrecs (void)
 Return number of messages. More...
 
int rpmlogCode (void)
 Return error code from last rpmError() message. More...
 
const char * rpmlogMessage (void)
 Return text of last rpmError() message. More...
 
const char * rpmlogRecMessage (rpmlogRec rec)
 Retrieve log message string from rpmlog record. More...
 
rpmlogLvl rpmlogRecPriority (rpmlogRec rec)
 Retrieve log priority from rpmlog record. 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...
 
rpmlogCallback rpmlogSetCallback (rpmlogCallback cb, rpmlogCallbackData data)
 Set rpmlog callback function. More...
 
void rpmlogGetCallback (rpmlogCallback *cb, rpmlogCallbackData *data)
 Get rpmlog callback function and data. More...
 
static int rpmlogDefault (rpmlogRec rec)
 
FILE * rpmlogSetFile (FILE *fp)
 Set rpmlog file handle. More...
 
const char * rpmlogLevelPrefix (rpmlogLvl pri)
 Return translated prefix string (if any) given log level. More...
 
static int vsnprintf (char *buf, int nb, const char *fmt, va_list ap)
 
void vrpmlog (unsigned code, const char *fmt, va_list ap)
 Same as _rpmlog with stdarg argument list. More...
 
void _rpmlog (int code, const char *fmt,...)
 Generate a log message using FMT string and option arguments. More...
 

Variables

static int nrecs = 0
 
static rpmlogRec recs = NULL
 
static unsigned rpmlogMask = RPMLOG_UPTO( RPMLOG_NOTICE )
 
static rpmlogCallback _rpmlogCallback
 
static rpmlogCallbackData _rpmlogCallbackData
 
static FILE * _stdlog = NULL
 
static const char * rpmlogMsgPrefix []
 

Macro Definition Documentation

#define _RPMLOG_INTERNAL

Definition at line 8 of file rpmlog.c.

Function Documentation

void _rpmlog ( int  code,
const char *  fmt,
  ... 
)

Generate a log message using FMT string and option arguments.

Note: inline'd to avoid debugging insturmentation overhead.

Definition at line 285 of file rpmlog.c.

References vrpmlog().

void rpmlogClose ( void  )

Close desriptor used to write to system logger.

Todo:
Implement.

Definition at line 69 of file rpmlog.c.

References _free(), i, and nrecs.

Referenced by rpmioClean().

int rpmlogCode ( void  )

Return error code from last rpmError() message.

Deprecated:
Perl-RPM needs, what's really needed is predictable, non-i18n encumbered, error text that can be retrieved through rpmlogMessage() and parsed IMHO.
Returns
code from last message

Definition at line 28 of file rpmlog.c.

References NULL.

static int rpmlogDefault ( rpmlogRec  rec)
static
void rpmlogGetCallback ( rpmlogCallback cb,
rpmlogCallbackData data 
)

Get rpmlog callback function and data.

Parameters
cbpointer to rpmlog callback function
datapointer to callback private (user) data
Returns
none

Definition at line 124 of file rpmlog.c.

References _rpmlogCallback, and _rpmlogCallbackData.

int rpmlogGetNrecs ( void  )

Return number of messages.

Returns
number of messages

Definition at line 23 of file rpmlog.c.

References nrecs.

Referenced by buildSpec().

const char* rpmlogLevelPrefix ( rpmlogLvl  pri)

Return translated prefix string (if any) given log level.

Parameters
prilog priority
Returns
message prefix (or "" for none)

Definition at line 188 of file rpmlog.c.

Referenced by rpmlogDefault().

const char* rpmlogMessage ( void  )

Return text of last rpmError() message.

Returns
text of last message

Definition at line 35 of file rpmlog.c.

References _, and NULL.

void rpmlogOpen ( const char *  ident,
int  option,
int  facility 
)

Open connection to system logger.

Todo:
Implement.

Definition at line 84 of file rpmlog.c.

void rpmlogPrint ( FILE *  f)

Print all rpmError() messages.

Parameters
ffile handle (NULL uses stderr)

Definition at line 53 of file rpmlog.c.

References fprintf(), i, nrecs, and NULL.

Referenced by buildSpec().

const char* rpmlogRecMessage ( rpmlogRec  rec)

Retrieve log message string from rpmlog record.

Parameters
recrpmlog record
Returns
log message

Definition at line 42 of file rpmlog.c.

References NULL.

rpmlogLvl rpmlogRecPriority ( rpmlogRec  rec)

Retrieve log priority from rpmlog record.

Parameters
recrpmlog record
Returns
log priority

Definition at line 47 of file rpmlog.c.

References RPMLOG_DEBUG.

rpmlogCallback rpmlogSetCallback ( rpmlogCallback  cb,
rpmlogCallbackData  data 
)

Set rpmlog callback function.

Parameters
cbrpmlog callback function
datacallback private (user) data
Returns
previous rpmlog callback function

Definition at line 114 of file rpmlog.c.

References _rpmlogCallback.

FILE* rpmlogSetFile ( FILE *  fp)

Set rpmlog file handle.

Parameters
fprpmlog file handle (NULL uses stdout/stderr)
Returns
previous rpmlog file handle

Definition at line 165 of file rpmlog.c.

References _stdlog.

Referenced by setLogFile().

int rpmlogSetMask ( int  mask)

Set the log mask level.

Parameters
masklog mask (0 is no operation)
Returns
previous log mask

Definition at line 98 of file rpmlog.c.

References rpmlogMask.

Referenced by doFoo(), and rpmlog().

void vrpmlog ( unsigned  code,
const char *  fmt,
va_list  ap 
)

Same as _rpmlog with stdarg argument list.

Definition at line 204 of file rpmlog.c.

References _free(), _rpmlogCallback, exit, EXIT_FAILURE, msg, nb, nrecs, NULL, RPMLOG_DEFAULT, RPMLOG_EXIT, RPMLOG_FAC, RPMLOG_MASK, RPMLOG_PRI, RPMLOG_WARNING, rpmlogDefault(), vsnprintf(), xmalloc, xrealloc, and xstrdup().

Referenced by _rpmlog(), and rpmlog().

static int vsnprintf ( char *  buf,
int  nb,
const char *  fmt,
va_list  ap 
)
inlinestatic

Definition at line 194 of file rpmlog.c.

Referenced by vrpmlog().

Variable Documentation

rpmlogCallback _rpmlogCallback
static

Definition at line 109 of file rpmlog.c.

Referenced by rpmlogGetCallback(), rpmlogSetCallback(), and vrpmlog().

rpmlogCallbackData _rpmlogCallbackData
static

Definition at line 112 of file rpmlog.c.

Referenced by rpmlogGetCallback().

FILE* _stdlog = NULL
static

Definition at line 133 of file rpmlog.c.

Referenced by rpmlogSetFile().

int nrecs = 0
static

Definition at line 19 of file rpmlog.c.

Referenced by rpmlogClose(), rpmlogGetNrecs(), rpmlogPrint(), and vrpmlog().

rpmlogRec recs = NULL
static

Definition at line 21 of file rpmlog.c.

Referenced by fpLookupSubdir(), handleOverlappedFiles(), and rpmtsCheckInstalledFiles().

unsigned rpmlogMask = RPMLOG_UPTO( RPMLOG_NOTICE )
static

Definition at line 91 of file rpmlog.c.

Referenced by rpmlogSetMask().

const char* rpmlogMsgPrefix[]
static
Initial value:
= {
N_("fatal error: "),
N_("fatal error: "),
N_("fatal error: "),
N_("error: "),
N_("warning: "),
"",
"",
"D: ",
}
#define N_(Text)
Definition: system.h:531

Definition at line 176 of file rpmlog.c.