libre  0.5.0
Macros | Functions
dbg.c File Reference

Debug printing. More...

#include <stdio.h>
#include <time.h>
#include <re_types.h>
#include <re_fmt.h>
#include <re_list.h>
#include <re_tmr.h>
#include <re_dbg.h>
Include dependency graph for dbg.c:

Go to the source code of this file.

Macros

#define dbg_lock()
 Stub.
#define dbg_unlock()
 Stub.

Functions

void dbg_init (int level, enum dbg_flags flags)
 Initialise debug printing.
void dbg_close (void)
 Close debugging.
int dbg_logfile_set (const char *name)
 Set debug logfile.
void dbg_handler_set (dbg_print_h *ph, void *arg)
 Set optional debug print handler.
void dbg_printf (int level, const char *fmt,...)
 Print a formatted debug message.
void dbg_noprintf (const char *fmt,...)
 Print a formatted debug message to /dev/null.
void dbg_warning (const char *fmt,...)
 Print a formatted warning message.
void dbg_notice (const char *fmt,...)
 Print a formatted notice message.
void dbg_info (const char *fmt,...)
 Print a formatted info message.
const char * dbg_level_str (int level)
 Get the name of the debug level.

Detailed Description

Debug printing.

Copyright (C) 2010 Creytiv.com

Definition in file dbg.c.

Function Documentation

void dbg_handler_set ( dbg_print_h ph,
void *  arg 
)

Set optional debug print handler.

Parameters
phPrint handler
argHandler argument

Definition at line 127 of file dbg.c.

References arg, and ph.

void dbg_info ( const char *  fmt,
  ... 
)

Print a formatted info message.

Parameters
fmtFormatted string

Definition at line 293 of file dbg.c.

References DBG_INFO.

void dbg_init ( int  level,
enum dbg_flags  flags 
)

Initialise debug printing.

Parameters
levelDebug level
flagsDebug flags

Definition at line 73 of file dbg.c.

References flags, level, and tmr_jiffies().

const char* dbg_level_str ( int  level)

Get the name of the debug level.

Parameters
levelDebug level
Returns
String with debug level name

Definition at line 314 of file dbg.c.

References DBG_ALERT, DBG_CRIT, DBG_DEBUG, DBG_EMERG, DBG_ERR, DBG_INFO, DBG_NOTICE, and DBG_WARNING.

int dbg_logfile_set ( const char *  name)

Set debug logfile.

Parameters
nameName of the logfile, NULL to close
Returns
0 if success, otherwise errorcode

Definition at line 100 of file dbg.c.

References dbg_close(), and re_fprintf().

void dbg_noprintf ( const char *  fmt,
  ... 
)

Print a formatted debug message to /dev/null.

Parameters
fmtFormatted string

Definition at line 244 of file dbg.c.

void dbg_notice ( const char *  fmt,
  ... 
)

Print a formatted notice message.

Parameters
fmtFormatted string

Definition at line 274 of file dbg.c.

References DBG_NOTICE.

void dbg_printf ( int  level,
const char *  fmt,
  ... 
)

Print a formatted debug message.

Parameters
levelDebug level
fmtFormatted string

Definition at line 225 of file dbg.c.

void dbg_warning ( const char *  fmt,
  ... 
)

Print a formatted warning message.

Parameters
fmtFormatted string

Definition at line 255 of file dbg.c.

References DBG_WARNING.