rpm: Logging API.

rpm 4.20.1 The RPM Package Manager

Loading...
Searching...
No Matches
Macros | Typedefs | Enumerations | Functions
Logging API.

RPM Logging facilities. More...

## Macros
#define | RPMLOG_DEFAULT 0x01

## Typedefs
typedef enum rpmlogLvl_e | rpmlogLvl
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 }

## Functions
const char * | rpmlogRecMessage (rpmlogRec rec)
rpmlogLvl | rpmlogRecPriority (rpmlogRec rec)
int | rpmlogGetNrecsByMask (unsigned mask)
int | rpmlogGetNrecs (void)
void | rpmlogPrintByMask (FILE *f, unsigned mask)
void | rpmlogPrint (FILE *f)
void | rpmlogClose (void)
void | rpmlogOpen (const char *ident, int option, int facility)
int | rpmlogSetMask (int mask)
void | rpmlog (int code, const char *fmt,...) RPM_GNUC_PRINTF(2
void const char * | rpmlogMessage (void)
int | rpmlogCode (void)
const char * | rpmlogLevelPrefix (rpmlogLvl pri)
rpmlogCallback | rpmlogSetCallback (rpmlogCallback cb, rpmlogCallbackData data)
FILE * | rpmlogSetFile (FILE *fp)

## Detailed Description

RPM Logging facilities.

## Macro Definition Documentation

## ◆ RPMLOG_DEFAULT

#define RPMLOG_DEFAULT 0x01

Option flags for callback return value. perform default logging

## 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

## ◆ rpmlogLvl

typedef enum rpmlogLvl_e rpmlogLvl

RPM Log levels. Priorities are encoded into bottom 3 bits of a single 32 bit quantity. The top 28 bits are currently unused.

## Enumeration Type Documentation

## ◆ rpmlogLvl_e

enum rpmlogLvl_e

RPM Log levels. Priorities are encoded into bottom 3 bits of a single 32 bit quantity. The top 28 bits are currently unused.

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

## 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

## ◆ rpmlogGetNrecsByMask()

int rpmlogGetNrecsByMask | ( | unsigned | mask | ) |

Return number of rpmError() messages matching a log mask.

Parameters

  mask | log mask to filter by (0 is no filtering)

Returns
  number of messages matching the mask

## ◆ 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)

## ◆ rpmlogPrintByMask()

void rpmlogPrintByMask | ( | FILE * | f,
|  | unsigned | mask )

Print all rpmError() messages matching a log mask.

Parameters

  f | file handle (NULL uses stderr)
  mask | log mask to filter by (0 is no filtering)

## ◆ 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