oRTP  0.24.0
Macros | Typedefs | Enumerations | Functions | Variables
logging.h File Reference

Logging API. More...

#include <ortp/port.h>

Go to the source code of this file.

Macros

#define ortp_log_level_enabled(level)   (ortp_get_log_level_mask() & (level))
 
#define CHECK_FORMAT_ARGS(m, n)
 
#define ortp_debug(...)
 

Typedefs

typedef void(* OrtpLogFunc )(OrtpLogLevel lev, const char *fmt, va_list args)
 

Enumerations

enum  OrtpLogLevel {
  ORTP_DEBUG =1, ORTP_MESSAGE =1<<1, ORTP_WARNING =1<<2, ORTP_ERROR =1<<3,
  ORTP_FATAL =1<<4, ORTP_TRACE =1<<5, ORTP_LOGLEV_END =1<<6
}
 

Functions

ORTP_PUBLIC void ortp_set_log_file (FILE *file)
 
ORTP_PUBLIC void ortp_set_log_handler (OrtpLogFunc func)
 
ORTP_PUBLIC OrtpLogFunc ortp_get_log_handler ()
 
ORTP_PUBLIC void ortp_logv (int level, const char *fmt, va_list args)
 
ORTP_PUBLIC void ortp_logv_flush (void)
 
ORTP_PUBLIC void ortp_set_log_level_mask (int levelmask)
 
ORTP_PUBLIC int ortp_get_log_level_mask (void)
 
ORTP_PUBLIC void ortp_set_log_thread_id (unsigned long thread_id)
 
static ORTP_INLINE void const char va_start (args, fmt)
 
 ortp_logv (lev, fmt, args)
 
 va_end (args)
 
 ortp_logv (ORTP_MESSAGE, fmt, args)
 
 ortp_logv (ORTP_WARNING, fmt, args)
 
 ortp_logv (ORTP_ERROR, fmt, args)
 
 ortp_logv (ORTP_FATAL, fmt, args)
 

Variables

ORTP_VAR_PUBLIC OrtpLogFunc ortp_logv_out
 
static ORTP_INLINE void const
char * 
fmt
 

Detailed Description

Logging API.

Function Documentation

ORTP_PUBLIC void ortp_logv_flush ( void  )

Flushes the log output queue. WARNING: Must be called from the thread that has been defined with ortp_set_log_thread_id().

Referenced by ortp_set_log_thread_id().

ORTP_PUBLIC void ortp_set_log_file ( FILE *  file)
Parameters
filea FILE pointer where to output the ortp logs.
ORTP_PUBLIC void ortp_set_log_handler ( OrtpLogFunc  func)
Parameters
funcyour logging function, compatible with the OrtpLogFunc prototype.
ORTP_PUBLIC void ortp_set_log_level_mask ( int  levelmask)

@ param levelmask a mask of ORTP_DEBUG, ORTP_MESSAGE, ORTP_WARNING, ORTP_ERROR ORTP_FATAL .

ORTP_PUBLIC void ortp_set_log_thread_id ( unsigned long  thread_id)

Tell oRTP the id of the thread used to output the logs. This is meant to output all the logs from the same thread to prevent deadlock problems at the application level.

Parameters
[in]thread_idThe id of the thread that will output the logs (can be obtained using ortp_thread_self()).

References ortp_logv_flush().

static ORTP_INLINE void va_start ( args  ,
fmt   
)
Initial value:
{
va_list args