Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

rpmio/rpmlog.c File Reference

More...

#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

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.

int vsnprintf (char *buf, int nb, const char *fmt, va_list ap)
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

int nrecs = 0
rpmlogRec recs = NULL
unsigned rpmlogMask = ((1 << (((unsigned)( RPMLOG_NOTICE ))+1)) - 1)
unsigned rpmlogFacility = RPMLOG_USER
rpmlogCallback _rpmlogCallback = NULL
FILE * _stdlog = NULL
char * rpmlogMsgPrefix []


Detailed Description

Definition in file rpmlog.c.


Define Documentation

#define va_copy DEST,
SRC       ((DEST) = (SRC))
 

Definition at line 18 of file rpmlog.c.

Referenced by vrpmlog().


Function Documentation

void* _free const void *    p [inline, static]
 

Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.

Parameters:
p  memory to free
Return values:
NULL  always

Definition at line 36 of file rpmlog.c.

int rpmErrorCode void   
 

Return error code from last rpmError() message.

Deprecated:
Perl-RPM needs, use rpmlogCode() instead.
Returns:
code from last message

Definition at line 266 of file rpmlog.c.

References rpmlogCode().

rpmlogCallback rpmErrorSetCallback rpmlogCallback    cb
 

Set rpmlog callback function.

Deprecated:
gnorpm needs, use rpmlogSetCallback() instead.

Definition at line 276 of file rpmlog.c.

References rpmlogCallback, and rpmlogSetCallback().

const char* rpmErrorString void   
 

Return text of last rpmError() message.

Deprecated:
gnorpm needs, use rpmlogMessage() instead.
Returns:
text of last 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   
 

Close desriptor used to write to system logger.

Todo:
Implement.

Definition at line 79 of file rpmlog.c.

References _free(), rpmlogRec_s::message, and nrecs.

Referenced by main().

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 47 of file rpmlog.c.

References nrecs.

Referenced by rpmErrorCode().

int rpmlogGetNrecs void   
 

Return number of rpmError() ressages.

Returns:
number of messages

Definition at line 42 of file rpmlog.c.

References nrecs.

Referenced by buildSpec().

const char* rpmlogMessage void   
 

Return text of last rpmError() message.

Returns:
text of last message

Definition at line 55 of file rpmlog.c.

References _, and nrecs.

Referenced by rpmErrorString().

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

Open connection to system logger.

Todo:
Implement.

Definition at line 94 of file rpmlog.c.

void rpmlogPrint FILE *    f
 

Print all rpmError() messages.

Parameters:
f  file handle (NULL uses stderr)

Definition at line 63 of file rpmlog.c.

References rpmlogRec_s::message, and nrecs.

Referenced by buildSpec().

rpmlogCallback rpmlogSetCallback rpmlogCallback    cb
 

Set rpmlog callback function.

Parameters:
cb  rpmlog callback function
Returns:
previous rpmlog callback function

Definition at line 118 of file rpmlog.c.

References _rpmlogCallback, and rpmlogCallback.

Referenced by rpmErrorSetCallback().

FILE* rpmlogSetFile FILE *    fp
 

Set rpmlog file handle.

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

Definition at line 130 of file rpmlog.c.

References _stdlog.

Referenced by setLogFile().

int rpmlogSetMask int    mask
 

Set the log mask level.

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

Definition at line 105 of file rpmlog.c.

References rpmlogMask.

void vrpmlog unsigned    code,
const char *    fmt,
va_list    ap
[static]
 

Definition at line 164 of file rpmlog.c.

References _, _free(), _rpmlogCallback, _stdlog, EXIT_FAILURE, nrecs, 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().

int vsnprintf char *    buf,
int    nb,
const char *    fmt,
va_list    ap
[inline, static]
 

Definition at line 154 of file rpmlog.c.

Referenced by fmagicPrintf(), snprintf(), and vrpmlog().


Variable Documentation

rpmlogCallback _rpmlogCallback = NULL [static]
 

Definition at line 116 of file rpmlog.c.

Referenced by rpmlogSetCallback(), and vrpmlog().

FILE* _stdlog = NULL [static]
 

Definition at line 128 of file rpmlog.c.

Referenced by rpmlogSetFile(), and vrpmlog().

int nrecs = 0 [static]
 

Definition at line 26 of file rpmlog.c.

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

rpmlogRec recs = NULL [static]
 

Definition at line 28 of file rpmlog.c.

unsigned rpmlogFacility = RPMLOG_USER [static]
 

Definition at line 103 of file rpmlog.c.

unsigned rpmlogMask = ((1 << (((unsigned)( RPMLOG_NOTICE ))+1)) - 1) [static]
 

Definition at line 100 of file rpmlog.c.

Referenced by rpmlogSetMask(), and vrpmlog().

char* rpmlogMsgPrefix[] [static]
 

Initial value:

 {
     "fatal error: " ,
     "fatal error: " ,
     "fatal error: " ,
     "error: " ,        
     "warning: " ,      
    "",                 
    "",                 
    "D: ",              
}

Definition at line 141 of file rpmlog.c.

Referenced by vrpmlog().


Generated on Sun Oct 26 13:02:08 2003 for rpm by doxygen1.2.18