libgpac
Documentation of the core library of GPAC
Logging tools

Logging System. More...

+ Collaboration diagram for Logging tools:

Data Structures

struct  GF_LogExtra
 Extra log instructions. More...
 

Macros

#define GF_LOG(_log_level, _log_tools, __args)
 Message logging. More...
 

Typedefs

typedef void(* gf_log_cbk) (void *cbck, GF_LOG_Level log_level, GF_LOG_Tool log_tool, const char *fmt, va_list vlist)
 Log Message Callback. More...
 

Enumerations

enum  GF_LOG_Level {
  GF_LOG_QUIET = 0 , GF_LOG_ERROR , GF_LOG_WARNING , GF_LOG_INFO ,
  GF_LOG_DEBUG
}
 GPAC Log Levels. More...
 
enum  GF_LOG_Tool {
  GF_LOG_CORE = 0 , GF_LOG_CODING , GF_LOG_CONTAINER , GF_LOG_NETWORK ,
  GF_LOG_HTTP , GF_LOG_RTP , GF_LOG_CODEC , GF_LOG_PARSER ,
  GF_LOG_MEDIA , GF_LOG_SCENE , GF_LOG_SCRIPT , GF_LOG_INTERACT ,
  GF_LOG_COMPOSE , GF_LOG_COMPTIME , GF_LOG_CACHE , GF_LOG_MMIO ,
  GF_LOG_RTI , GF_LOG_MEMORY , GF_LOG_AUDIO , GF_LOG_MODULE ,
  GF_LOG_MUTEX , GF_LOG_CONDITION , GF_LOG_DASH , GF_LOG_FILTER ,
  GF_LOG_SCHEDULER , GF_LOG_ROUTE , GF_LOG_CONSOLE , GF_LOG_APP ,
  GF_LOG_ALL , GF_LOG_TOOL_MAX = GF_LOG_ALL , GF_LOG_TOOL_UNDEFINED
}
 GPAC Log tools. More...
 

Functions

Bool gf_log_set_strict_error (Bool strict)
 Log exits at first error assignment. More...
 
char * gf_log_get_tools_levels (void)
 gets string-formatted log tools More...
 
void gf_log_set_tool_level (GF_LOG_Tool log_tool, GF_LOG_Level log_level)
 Log modules assignment. More...
 
gf_log_cbk gf_log_set_callback (void *usr_cbk, gf_log_cbk cbk)
 Log overwrite. More...
 
Bool gf_log_tool_level_on (GF_LOG_Tool log_tool, GF_LOG_Level log_level)
 Log level checking. More...
 
const char * gf_log_tool_name (GF_LOG_Tool log_tool)
 Log tool name. More...
 
u32 gf_log_get_tool_level (GF_LOG_Tool log_tool)
 Log level getter. More...
 
GF_Err gf_log_set_tools_levels (const char *log_tools_levels, Bool reset_all)
 Set log tools and levels. More...
 
GF_Err gf_log_modify_tools_levels (const char *val)
 Modify log tools and levels. More...
 
Bool gf_log_use_color ()
 Checks if color logs is enabled. More...
 
Bool gf_log_use_file ()
 Checks if logs are stored to file. More...
 
u32 gf_log_parse_tool (const char *logs)
 Parses a log tool. More...
 
void gf_log_reset_file ()
 Resets log file Resets log file if any log file name was specified, by closing and reopening a new file. More...
 
void gf_log_push_extra (const GF_LogExtra *log)
 
void gf_log_pop_extra (const GF_LogExtra *log)
 
void gf_log_reset_extras ()
 

Detailed Description


Data Structure Documentation

◆ GF_LogExtra

struct GF_LogExtra
Data Fields
u32 nb_tools number of tools and levels
GF_LOG_Tool * tools additionnal tools
GF_LOG_Level * levels additionnal levels for the tools
Bool strict exit if error

Macro Definition Documentation

◆ GF_LOG

#define GF_LOG (   _log_level,
  _log_tools,
  __args 
)

Macro for logging messages. Usage is GF_LOG(log_lev, log_module, (fmt, ...)). The log function is only called if log filtering allows it. This avoids fetching logged parameters when the tool is not being logged.

Typedef Documentation

◆ gf_log_cbk

typedef void(* gf_log_cbk) (void *cbck, GF_LOG_Level log_level, GF_LOG_Tool log_tool, const char *fmt, va_list vlist)

The gf_log_cbk type is the type for the callback of the gf_log_set_callback function. By default all logs are redirected to stderr

Parameters
cbckOpaque user data.
log_levellevel of the log. This value is not guaranteed in multi-threaded context.
log_tooltool emitting the log. This value is not guaranteed in multi-threaded context.
fmtmessage log format.
vlistmessage log param.

Enumeration Type Documentation

◆ GF_LOG_Level

These levels describes messages priority used when filtering logs

Enumerator
GF_LOG_QUIET 

Disable all Log message

GF_LOG_ERROR 

Log message describes an error

GF_LOG_WARNING 

Log message describes a warning

GF_LOG_INFO 

Log message is informational (state, etc..)

GF_LOG_DEBUG 

Log message is a debug info

◆ GF_LOG_Tool

These flags describes which sub-part of GPAC generates the log and are used when filtering logs

Enumerator
GF_LOG_CORE 

Log message from the core library (init, threads, network calls, etc)

GF_LOG_CODING 

Log message from a raw media parser (BIFS, LASeR, A/V formats)

GF_LOG_CONTAINER 

Log message from a bitstream parser (IsoMedia, MPEG-2 TS, OGG, ...)

GF_LOG_NETWORK 

Log message from the network/service stack (messages & co)

GF_LOG_HTTP 

Log message from the HTTP stack

GF_LOG_RTP 

Log message from the RTP/RTCP stack (TS info) and packet structure & hinting (debug)

GF_LOG_CODEC 

Log message from a codec

GF_LOG_PARSER 

Log message from any textual (XML, ...) parser (context loading, etc)

GF_LOG_MEDIA 

Generic log message from a filter (not from filter core library)

GF_LOG_SCENE 

Log message from the scene graph/scene manager (handling of nodes and attribute modif, DOM core)

GF_LOG_SCRIPT 

Log message from the scripting engine APIs - does not cover alert() in the script code itself

GF_LOG_INTERACT 

Log message from event handling

GF_LOG_COMPOSE 

Log message from compositor

GF_LOG_COMPTIME 

Log message from the compositor, indicating media object state

GF_LOG_CACHE 

Log for video object cache

GF_LOG_MMIO 

Log message from multimedia I/O devices (audio/video input/output, ...)

GF_LOG_RTI 

Log for runtime info (times, memory, CPU usage)

GF_LOG_MEMORY 

Log for memory tracker

GF_LOG_AUDIO 

Log for audio compositor

GF_LOG_MODULE 

Generic Log for modules

GF_LOG_MUTEX 

Log for threads and mutexes

GF_LOG_CONDITION 

Log for threads and condition

GF_LOG_DASH 

Log for all HTTP streaming

GF_LOG_FILTER 

Log for all messages from filter core library (not from a filter)

GF_LOG_SCHEDULER 

Log for filter scheduler only

GF_LOG_ROUTE 

Log for all ROUTE message

GF_LOG_CONSOLE 

Log for all messages coming from script

GF_LOG_APP 

Log for all messages coming the application, not used by libgpac or the modules

GF_LOG_ALL 

special value used to set a level for all tools

GF_LOG_TOOL_MAX 
GF_LOG_TOOL_UNDEFINED 

Function Documentation

◆ gf_log_set_strict_error()

Bool gf_log_set_strict_error ( Bool  strict)

When GF_LOG_ERROR happens, program leaves with instruction exit(1);

Parameters
strictstrict behavior when encoutering a serious error.
Returns
old value before the call.
+ Here is the caller graph for this function:

◆ gf_log_get_tools_levels()

char* gf_log_get_tools_levels ( void  )

Gets the string-formatted log tools and levels. Returned string shall be freed by the caller.

Returns
string-formatted log tools.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_log_set_tool_level()

void gf_log_set_tool_level ( GF_LOG_Tool  log_tool,
GF_LOG_Level  log_level 
)

Sets the tools to be checked for log filtering. By default no logging is performed.

Parameters
log_toolthe tool to be logged
log_levelthe level of logging for this tool
+ Here is the caller graph for this function:

◆ gf_log_set_callback()

gf_log_cbk gf_log_set_callback ( void *  usr_cbk,
gf_log_cbk  cbk 
)

Assigns a user-defined callback for printing log messages. By default all logs are redirected to stderr

Parameters
usr_cbkOpaque user data
cbkCallback log function
Returns
previous callback function
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_log_tool_level_on()

Bool gf_log_tool_level_on ( GF_LOG_Tool  log_tool,
GF_LOG_Level  log_level 
)

Checks if a given tool is logged for the given level

Parameters
log_tooltool to check
log_levellevel to check
Returns
1 if logged, 0 otherwise
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_log_tool_name()

const char* gf_log_tool_name ( GF_LOG_Tool  log_tool)

Gets log tool name

Parameters
log_tooltool to check
Returns
name, or "unknwon" if not known

◆ gf_log_get_tool_level()

u32 gf_log_get_tool_level ( GF_LOG_Tool  log_tool)

Gets log level of a given tool

Parameters
log_tooltool to check
Returns
log level of tool
+ Here is the caller graph for this function:

◆ gf_log_set_tools_levels()

GF_Err gf_log_set_tools_levels ( const char *  log_tools_levels,
Bool  reset_all 
)

Set log tools and levels according to the log_tools_levels string.

Parameters
log_tools_levelsstring specifying the tools and levels. It is formatted as logToolX@logLevelX:logToolZ@logLevelZ:...
reset_allif GF_TRUE, all previous log settings are discarded.
Returns
GF_OK or GF_BAD_PARAM
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_log_modify_tools_levels()

GF_Err gf_log_modify_tools_levels ( const char *  val)

Modify log tools and levels according to the log_tools_levels string. Previous log settings are kept.

Parameters
valstring specifying the tools and levels. It is formatted as logToolX@logLevelX:logToolZ@logLevelZ:...
Returns
GF_OK or GF_BAD_PARAM
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_log_use_color()

Bool gf_log_use_color ( )

Checks if color logs is enabled

Returns
GF_TRUE if color logs are used
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_log_use_file()

Bool gf_log_use_file ( )

Checks if logs are stored to file

Returns
GF_TRUE if logs are stored to file
+ Here is the caller graph for this function:

◆ gf_log_parse_tool()

u32 gf_log_parse_tool ( const char *  logs)

Parses a log tool by name

Parameters
logsthe name to parse
Returns
log tool value
+ Here is the caller graph for this function:

◆ gf_log_reset_file()

void gf_log_reset_file ( )
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_log_push_extra()

void gf_log_push_extra ( const GF_LogExtra log)

Register a new extra log levels

Parameters
logextra levels to add - may be NULL but shall be valid until call to gf_log_pop_extra or gf_log_reset_extras or end of app
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_log_pop_extra()

void gf_log_pop_extra ( const GF_LogExtra log)

Unregister an extra log levels

Parameters
logextra levels to add - may be NULL
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_log_reset_extras()

void gf_log_reset_extras ( )

Unregister all extra log levels

+ Here is the call graph for this function:
+ Here is the caller graph for this function: