rpm: Logging API.

rpm 4.16.1.3

Macros | Typedefs | Enumerations | Functions
Logging API.

RPM Logging facilities. More...

## Macros
#define | RPMLOG_DEFAULT 0x01
| Option flags for callback return value. More...

## Typedefs
typedef enum rpmlogLvl_e | rpmlogLvl
| RPM Log levels. More...
typedef enum rpmlogFac_e | rpmlogFac
| facility codes More...
typedef struct rpmlogRec_s * | rpmlogRec
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

RPM Logging facilities.

## Macro Definition Documentation

## ◆ RPMLOG_DEFAULT

#define RPMLOG_DEFAULT 0x01

Option flags for callback return value.

perform default logging

Definition at line 102 of file rpmlog.h.

## Typedef Documentation

## ◆ rpmlogCallback

typedef int(* rpmlogCallback) (rpmlogRec rec, rpmlogCallbackData data)

Parameters

  rec | rpmlog record
  data | private callback data

Returns
  flags to define further behavior: RPMLOG_DEFAULT to perform default logging, RPMLOG_EXIT to exit after processing, 0 to return after callback

Definition at line 133 of file rpmlog.h.

## ◆ rpmlogFac

typedef enum rpmlogFac_e rpmlogFac

facility codes

## ◆ rpmlogLvl

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)

## ◆ rpmlogRec

typedef struct rpmlogRec_s* rpmlogRec

Definition at line 107 of file rpmlog.h.

## Enumeration Type Documentation

## ◆ rpmlogFac_e

enum rpmlogFac_e

facility codes

Enumerator
RPMLOG_KERN | kernel messages
RPMLOG_USER | random user-level messages
RPMLOG_MAIL | mail system
RPMLOG_DAEMON | system daemons
RPMLOG_AUTH | security/authorization messages
RPMLOG_SYSLOG | messages generated internally by syslogd
RPMLOG_LPR | line printer subsystem
RPMLOG_NEWS | network news subsystem
RPMLOG_UUCP | UUCP subsystem
RPMLOG_CRON | clock daemon
RPMLOG_AUTHPRIV | security/authorization messages (private)
RPMLOG_FTP | ftp daemon
RPMLOG_LOCAL0 | reserved for local use
RPMLOG_LOCAL1 | reserved for local use
RPMLOG_LOCAL2 | reserved for local use
RPMLOG_LOCAL3 | reserved for local use
RPMLOG_LOCAL4 | reserved for local use
RPMLOG_LOCAL5 | reserved for local use
RPMLOG_LOCAL6 | reserved for local use
RPMLOG_LOCAL7 | reserved for local use
RPMLOG_ERRMSG |

Definition at line 48 of file rpmlog.h.

## ◆ rpmlogLvl_e

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)

Enumerator
RPMLOG_EMERG | system is unusable
RPMLOG_ALERT | action must be taken immediately
RPMLOG_CRIT | critical conditions
RPMLOG_ERR | error conditions
RPMLOG_WARNING | warning conditions
RPMLOG_NOTICE | normal but significant condition
RPMLOG_INFO | informational
RPMLOG_DEBUG | debug-level messages

Definition at line 29 of file rpmlog.h.

## Function Documentation

## ◆ rpmlog()

void rpmlog | ( | int | code,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Generate a log message using FMT string and option arguments.

## ◆ rpmlogClose()

void rpmlogClose | ( | void |  | ) |

Close desriptor used to write to system logger.

Todo:
  Implement.

## ◆ rpmlogCode()

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

## ◆ rpmlogGetNrecs()

int rpmlogGetNrecs | ( | void |  | ) |

Return number of rpmError() ressages.

Returns
  number of messages

## ◆ rpmlogLevelPrefix()

const char* rpmlogLevelPrefix | ( | rpmlogLvl | pri | ) |

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

Parameters

  pri | log priority

Returns
  message prefix (or "" for none)

## ◆ rpmlogMessage()

void const char* rpmlogMessage | ( | void |  | ) |

Return text of last rpmError() message.

Returns
  text of last message

## ◆ rpmlogOpen()

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

Open connection to system logger.

Todo:
  Implement.

## ◆ rpmlogPrint()

void rpmlogPrint | ( | FILE * | f | ) |

Print all rpmError() messages.

Parameters

  f | file handle (NULL uses stderr)

## ◆ rpmlogRecMessage()

const char* rpmlogRecMessage | ( | rpmlogRec | rec | ) |

Retrieve log message string from rpmlog record.

Parameters

  rec | rpmlog record

Returns
  log message

## ◆ rpmlogRecPriority()

rpmlogLvl rpmlogRecPriority | ( | rpmlogRec | rec | ) |

Retrieve log priority from rpmlog record.

Parameters

  rec | rpmlog record

Returns
  log priority

## ◆ rpmlogSetCallback()

rpmlogCallback rpmlogSetCallback | ( | rpmlogCallback | cb,
|  | rpmlogCallbackData | data
| ) |  |

Set rpmlog callback function.

Parameters

  cb | rpmlog callback function
  data | callback private (user) data

Returns
  previous rpmlog callback function

## ◆ rpmlogSetFile()

FILE* rpmlogSetFile | ( | FILE * | fp | ) |

Set rpmlog file handle.

Parameters

  fp | rpmlog file handle (NULL uses stdout/stderr)

Returns
  previous rpmlog file handle

## ◆ rpmlogSetMask()

int rpmlogSetMask | ( | int | mask | ) |

Set the log mask level.

Parameters

  mask | log mask (0 is no operation)

Returns
  previous log mask