FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Modules | Macros | Functions
Logging Facility

Modules

 Logging Constants
 

Macros

#define AV_LOG_C(x)   ((x) << 8)
 Sets additional colors for extended debugging sessions. More...
 
#define av_dlog(pctx,...)   do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0)
 av_dlog macros More...
 
#define AV_LOG_SKIP_REPEATED   1
 Skip repeated messages, this requires the user app to use av_log() instead of (f)printf as the 2 would otherwise interfere and lead to "Last message repeated x times" messages below (f)printf messages with some bad luck. More...
 
#define AV_LOG_PRINT_LEVEL   2
 Include the log severity in messages originating from codecs. More...
 

Functions

void av_log (void *avcl, int level, const char *fmt,...) av_printf_format(3
 Send the specified message to the log if the level is less than or equal to the current av_log_level. More...
 
void void av_vlog (void *avcl, int level, const char *fmt, va_list vl)
 Send the specified message to the log if the level is less than or equal to the current av_log_level. More...
 
int av_log_get_level (void)
 Get the current log level. More...
 
void av_log_set_level (int level)
 Set the log level. More...
 
void av_log_set_callback (void(*callback)(void *, int, const char *, va_list))
 Set the logging callback. More...
 
void av_log_default_callback (void *avcl, int level, const char *fmt, va_list vl)
 Default logging callback. More...
 
const char * av_default_item_name (void *ctx)
 Return the context name. More...
 
AVClassCategory av_default_get_category (void *ptr)
 
void av_log_format_line (void *ptr, int level, const char *fmt, va_list vl, char *line, int line_size, int *print_prefix)
 Format a line of log the same way as the default callback. More...
 
int av_log_format_line2 (void *ptr, int level, const char *fmt, va_list vl, char *line, int line_size, int *print_prefix)
 Format a line of log the same way as the default callback. More...
 
void av_log_set_flags (int arg)
 
int av_log_get_flags (void)
 

Detailed Description

Macro Definition Documentation

#define AV_LOG_C (   x)    ((x) << 8)

Sets additional colors for extended debugging sessions.

av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n");

Requires 256color terminal support. Uses outside debugging is not recommended.

Definition at line 218 of file log.h.

#define av_dlog (   pctx,
  ... 
)    do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0)

av_dlog macros

Deprecated:
unused Useful to print debug messages that shouldn't get compiled in normally.

Definition at line 347 of file log.h.

#define AV_LOG_SKIP_REPEATED   1

Skip repeated messages, this requires the user app to use av_log() instead of (f)printf as the 2 would otherwise interfere and lead to "Last message repeated x times" messages below (f)printf messages with some bad luck.

Also to receive the last, "last repeated" line if any, the user app must call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end

Definition at line 359 of file log.h.

Referenced by av_log_default_callback(), main(), and opt_loglevel().

#define AV_LOG_PRINT_LEVEL   2

Include the log severity in messages originating from codecs.

Results in messages such as: [rawvideo @ 0xDEADBEEF] [error] encode did not produce valid pts

Definition at line 367 of file log.h.

Referenced by format_line().

Function Documentation

void av_log ( void avcl,
int  level,
const char *  fmt,
  ... 
)

Send the specified message to the log if the level is less than or equal to the current av_log_level.

By default, all logging messages are sent to stderr. This behavior can be altered by setting a different logging callback function.

See Also
av_log_set_callback
Parameters
avclA pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct or NULL if general log.
levelThe importance level of the message expressed using a Logging Constant.
fmtThe format string (printf-compatible) that specifies how subsequent arguments are converted to output.
void void av_vlog ( void avcl,
int  level,
const char *  fmt,
va_list  vl 
)

Send the specified message to the log if the level is less than or equal to the current av_log_level.

By default, all logging messages are sent to stderr. This behavior can be altered by setting a different logging callback function.

See Also
av_log_set_callback
Parameters
avclA pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct.
levelThe importance level of the message expressed using a Logging Constant.
fmtThe format string (printf-compatible) that specifies how subsequent arguments are converted to output.
vlThe arguments referenced by the format string.

Definition at line 379 of file log.c.

Referenced by ass_log(), av_log(), av_log_ask_for_sample(), missing_feature_sample(), print_log(), rtmp_log(), vreport_config_error(), vs2av_log(), X264_log(), and XAVS_log().

int av_log_get_level ( void  )

Get the current log level.

See Also
Logging Constants
Returns
Current log level

Definition at line 386 of file log.c.

Referenced by avcodec_string(), check_keyboard_interaction(), config_input(), filter_frame(), hex_log(), http_av_log(), init(), libwebp_anim_encode_init(), lookup_signatures(), print_report(), and rtmp_open().

void av_log_set_level ( int  level)

Set the log level.

See Also
Logging Constants
Parameters
levelLogging level

Definition at line 391 of file log.c.

Referenced by AVCodecInitialize(), check_keyboard_interaction(), main(), opt_default(), opt_loglevel(), test_av_parse_color(), test_av_parse_time(), and test_av_small_strptime().

void av_log_set_callback ( void(*)(void *, int, const char *, va_list)  callback)

Set the logging callback.

Note
The callback must be thread safe, even if the application does not use threads itself as some codecs are multithreaded.
See Also
av_log_default_callback
Parameters
callbackA logging function with a compatible signature.

Definition at line 406 of file log.c.

Referenced by init_count_warnings(), init_report(), main(), reset_count_warnings(), show_buildconf(), show_help(), show_help_default(), and show_version().

void av_log_default_callback ( void avcl,
int  level,
const char *  fmt,
va_list  vl 
)

Default logging callback.

It prints the message to stderr, optionally colorizing it.

Parameters
avclA pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct.
levelThe importance level of the message expressed using a Logging Constant.
fmtThe format string (printf-compatible) that specifies how subsequent arguments are converted to output.
vlThe arguments referenced by the format string.

Definition at line 302 of file log.c.

Referenced by log_callback(), log_callback_report(), and reset_count_warnings().

const char* av_default_item_name ( void ctx)

Return the context name.

Parameters
ctxThe AVClass context
Returns
The AVClass class_name

Definition at line 193 of file log.c.

AVClassCategory av_default_get_category ( void ptr)

Definition at line 198 of file log.c.

void av_log_format_line ( void ptr,
int  level,
const char *  fmt,
va_list  vl,
char *  line,
int  line_size,
int print_prefix 
)

Format a line of log the same way as the default callback.

Parameters
linebuffer to receive the formatted line
line_sizesize of the buffer
print_prefixused to store whether the prefix must be printed; must point to a persistent integer initially set to 1

Definition at line 284 of file log.c.

Referenced by log_callback(), and log_callback_report().

int av_log_format_line2 ( void ptr,
int  level,
const char *  fmt,
va_list  vl,
char *  line,
int  line_size,
int print_prefix 
)

Format a line of log the same way as the default callback.

Parameters
linebuffer to receive the formatted line; may be NULL if line_size is 0
line_sizesize of the buffer; at most line_size-1 characters will be written to the buffer, plus one null terminator
print_prefixused to store whether the prefix must be printed; must point to a persistent integer initially set to 1
Returns
Returns a negative value if an error occurred, otherwise returns the number of characters that would have been written for a sufficiently large buffer, not including the terminating null character. If the return value is not less than line_size, it means that the log message was truncated to fit the buffer.

Definition at line 290 of file log.c.

Referenced by av_log_format_line(), and call_log_format_line2().

void av_log_set_flags ( int  arg)

Definition at line 396 of file log.c.

Referenced by main(), and opt_loglevel().

int av_log_get_flags ( void  )

Definition at line 401 of file log.c.

Referenced by opt_loglevel().