Loading...
Searching...
No Matches
Logging Facility
libavutil

## Modules

| Logging Constants

## Macros

#define | AV_LOG_C(x) ((x) << 8)
| Sets additional colors for extended debugging sessions.
#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.
#define | AV_LOG_PRINT_LEVEL 2
| Include the log severity in messages originating from codecs.

## 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.
void void | av_log_once (void *avcl, int initial_level, int subsequent_level, int *state, const char *fmt,...) av_printf_format(5
| Send the specified message to the log once with the initial_level and then with the subsequent_level.
void 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.
int | av_log_get_level (void)
| Get the current log level.
void | av_log_set_level (int level)
| Set the log level.
void | av_log_set_callback (void(*callback)(void *, int, const char *, va_list))
| Set the logging callback.
void | av_log_default_callback (void *avcl, int level, const char *fmt, va_list vl)
| Default logging callback.
const char * | av_default_item_name (void *ctx)
| Return the context name.
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.
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.
void | av_log_set_flags (int arg)
int | av_log_get_flags (void)

## Detailed Description

## Macro Definition Documentation

## AV_LOG_C

#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");
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition log.h:201
AV_LOG_C
#define AV_LOG_C(x)
Sets additional colors for extended debugging sessions.
Definition log.h:222
av_log
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.

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

Definition at line 222 of file log.h.

## AV_LOG_SKIP_REPEATED

#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 370 of file log.h.

## AV_LOG_PRINT_LEVEL

#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 378 of file log.h.

## Function Documentation

## av_log()

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

  avcl | A pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct or NULL if general log.
  level | The importance level of the message expressed using a Logging Constant.
  fmt | The format string (printf-compatible) that specifies how subsequent arguments are converted to output.

Examples
  avio_list_dir.c, decode_filter_audio.c, decode_filter_video.c, filter_audio.c, qsv_transcode.c, show_metadata.c, and transcode.c.

Referenced by encode_write_frame(), filter_encode_write_frame(), flush_encoder(), init_filter(), init_filter_graph(), init_filters(), init_filters(), list_op(), main(), open_input_file(), open_input_file(), open_input_file(), and open_output_file().

## av_log_once()

void void av_log_once | ( | void * | avcl,
|  | int | initial_level,
|  | int | subsequent_level,
|  | int * | state,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Send the specified message to the log once with the initial_level and then with the subsequent_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

Parameters

  avcl | A pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct or NULL if general log.
  initial_level | importance level of the message expressed using a Logging Constant for the first occurance.
  subsequent_level | importance level of the message expressed using a Logging Constant after the first occurance.
  fmt | The format string (printf-compatible) that specifies how subsequent arguments are converted to output.
  state | a variable to keep trak of if a message has already been printed this must be initialized to 0 before the first use. The same state must not be accessed by 2 Threads simultaneously.

## av_vlog()

void 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

  avcl | A pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct.
  level | The importance level of the message expressed using a Logging Constant.
  fmt | The format string (printf-compatible) that specifies how subsequent arguments are converted to output.
  vl | The arguments referenced by the format string.

## av_log_get_level()

int av_log_get_level | ( | void |  | ) |

Get the current log level.

See also
  Logging Constants

Returns
  Current log level

## av_log_set_level()

void av_log_set_level | ( | int | level | ) |

Set the log level.

See also
  Logging Constants

Parameters

  level | Logging level

Examples
  avio_list_dir.c.

Referenced by main().

## av_log_set_callback()

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

  callback | A logging function with a compatible signature.

## av_log_default_callback()

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

  avcl | A pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct.
  level | The importance level of the message expressed using a Logging Constant.
  fmt | The format string (printf-compatible) that specifies how subsequent arguments are converted to output.
  vl | The arguments referenced by the format string.

## av_default_item_name()

const char * av_default_item_name | ( | void * | ctx | ) |

Return the context name.

Parameters

  ctx | The AVClass context

Returns
  The AVClass class_name

## av_default_get_category()

AVClassCategory av_default_get_category | ( | void * | ptr | ) |

## av_log_format_line()

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

  line | buffer to receive the formatted line
  line_size | size of the buffer
  print_prefix | used to store whether the prefix must be printed; must point to a persistent integer initially set to 1

## av_log_format_line2()

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

  line | buffer to receive the formatted line; may be NULL if line_size is 0
  line_size | size of the buffer; at most line_size-1 characters will be written to the buffer, plus one null terminator
  print_prefix | used 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.

## av_log_set_flags()

void av_log_set_flags | ( | int | arg | ) |

## av_log_get_flags()

int av_log_get_flags | ( | void |  | ) |