History

log: Introduce a more verbose debug level

And deprecate av_dlog macro.

Vittorio Giovara committed 11 years ago

Commit c2533401 parent b8d7f316 files · +24 −4Browse files

Unified · Split

6 files
  1. cmdutils.c +1 −0
  2. doc/APIchanges +3 −0
  3. doc/avtools-common-opts.texi +1 −0
  4. libavutil/log.c +6 −3
  5. libavutil/log.h +9 −0
  6. libavutil/version.h +4 −1
cmdutils.c+1−0
@@ -724,6 +724,7 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg) · 723 unmodified lines
724 { "info" , AV_LOG_INFO },724 { "info" , AV_LOG_INFO },
725 { "verbose", AV_LOG_VERBOSE },725 { "verbose", AV_LOG_VERBOSE },
726 { "debug" , AV_LOG_DEBUG },726 { "debug" , AV_LOG_DEBUG },
727 { "trace" , AV_LOG_TRACE },
727 };728 };
728 char *tail;729 char *tail;
729 int level;730 int level;
doc/APIchanges+3−0
@@ -13,6 +13,9 @@ libavutil: 2014-08-09 · 12 unmodified lines
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162015-xx-xx - xxxxxxx - lavu 54.12.0
17 Add AV_LOG_TRACE for extremely verbose debugging.
18
162015-xx-xx - xxxxxxx - lavu 54.11.0192015-xx-xx - xxxxxxx - lavu 54.11.0
17 Add av_small_strptime().20 Add av_small_strptime().
18 21
doc/avtools-common-opts.texi+1−0
@@ -145,6 +145,7 @@ Set the logging level used by the library. · 144 unmodified lines
145@item info145@item info
146@item verbose146@item verbose
147@item debug147@item debug
148@item trace
148@end table149@end table
149 150
150By default the program logs to stderr, if coloring is supported by the151By default the program logs to stderr, if coloring is supported by the
libavutil/log.c+6−3
@@ -43,16 +43,19 @@ · 42 unmodified lines
43static int av_log_level = AV_LOG_INFO;43static int av_log_level = AV_LOG_INFO;
44static int flags;44static int flags;
45 45
46#define NB_LEVELS 8
46#if HAVE_SETCONSOLETEXTATTRIBUTE47#if HAVE_SETCONSOLETEXTATTRIBUTE
47#include <windows.h>48#include <windows.h>
48static const uint8_t color[] = { 12, 12, 12, 14, 7, 10, 11 };49static const uint8_t color[NB_LEVELS] = { 12, 12, 12, 14, 7, 10, 11, 8};
49static int16_t background, attr_orig;50static int16_t background, attr_orig;
50static HANDLE con;51static HANDLE con;
51#define set_color(x) SetConsoleTextAttribute(con, background | color[x])52#define set_color(x) SetConsoleTextAttribute(con, background | color[x])
52#define reset_color() SetConsoleTextAttribute(con, attr_orig)53#define reset_color() SetConsoleTextAttribute(con, attr_orig)
53#define print_256color(x)54#define print_256color(x)
54#else55#else
55static const uint8_t color[] = { 0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x06 };56static const uint8_t color[NB_LEVELS] = {
57 0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x06, 0x07
58};
56#define set_color(x) fprintf(stderr, "\033[%d;3%dm", color[x] >> 4, color[x]&15)59#define set_color(x) fprintf(stderr, "\033[%d;3%dm", color[x] >> 4, color[x]&15)
57#define print_256color(x) fprintf(stderr, "\033[38;5;%dm", x)60#define print_256color(x) fprintf(stderr, "\033[38;5;%dm", x)
58#define reset_color() fprintf(stderr, "\033[0m")61#define reset_color() fprintf(stderr, "\033[0m")
@@ -159,7 +162,7 @@ void av_log_default_callback(void *avcl, int level, const char *fmt, va_list vl) · 100 unmodified lines
159 fprintf(stderr, " Last message repeated %d times\n", count);162 fprintf(stderr, " Last message repeated %d times\n", count);
160 count = 0;163 count = 0;
161 }164 }
162 colored_fputs(av_clip(level >> 3, 0, 6), tint >> 8, line);165 colored_fputs(av_clip(level >> 3, 0, NB_LEVELS - 1), tint >> 8, line);
163 av_strlcpy(prev, line, sizeof line);166 av_strlcpy(prev, line, sizeof line);
164}167}
165 168
libavutil/log.h+9−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
24#include <stdarg.h>24#include <stdarg.h>
25#include "avutil.h"25#include "avutil.h"
26#include "attributes.h"26#include "attributes.h"
27#include "version.h"
27 28
28/**29/**
29 * Describe the class of an AVClass context structure. That is an30 * Describe the class of an AVClass context structure. That is an
@@ -143,6 +144,11 @@ typedef struct AVClass { · 113 unmodified lines
143 */144 */
144#define AV_LOG_DEBUG 48145#define AV_LOG_DEBUG 48
145 146
147/**
148 * Extremely verbose debugging, useful for libav* development.
149 */
150#define AV_LOG_TRACE 56
151
146/**152/**
147 * @}153 * @}
148 */154 */
@@ -243,8 +249,10 @@ void av_log_default_callback(void *avcl, int level, const char *fmt, · 94 unmodified lines
243 */249 */
244const char* av_default_item_name(void* ctx);250const char* av_default_item_name(void* ctx);
245 251
252#if FF_API_DLOG
246/**253/**
247 * av_dlog macros254 * av_dlog macros
255 * @deprecated unused
248 * Useful to print debug messages that shouldn't get compiled in normally.256 * Useful to print debug messages that shouldn't get compiled in normally.
249 */257 */
250 258
@@ -253,6 +261,7 @@ const char* av_default_item_name(void* ctx); · 2 unmodified lines
253#else261#else
254# define av_dlog(pctx, ...)262# define av_dlog(pctx, ...)
255#endif263#endif
264#endif /* FF_API_DLOG */
256 265
257/**266/**
258 * Skip repeated messages, this requires the user app to use av_log() instead of267 * Skip repeated messages, this requires the user app to use av_log() instead of
libavutil/version.h+4−1
@@ -54,7 +54,7 @@ · 53 unmodified lines
54 */54 */
55 55
56#define LIBAVUTIL_VERSION_MAJOR 5456#define LIBAVUTIL_VERSION_MAJOR 54
57#define LIBAVUTIL_VERSION_MINOR 1157#define LIBAVUTIL_VERSION_MINOR 12
58#define LIBAVUTIL_VERSION_MICRO 058#define LIBAVUTIL_VERSION_MICRO 0
59 59
60#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \60#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -111,6 +111,9 @@ · 50 unmodified lines
111#ifndef FF_API_OPT_TYPE_METADATA111#ifndef FF_API_OPT_TYPE_METADATA
112#define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 55)112#define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 55)
113#endif113#endif
114#ifndef FF_API_DLOG
115#define FF_API_DLOG (LIBAVUTIL_VERSION_MAJOR < 55)
116#endif
114 117
115 118
116/**119/**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t