[FFmpeg-devel] [PATCH] Add some prefixes to messages

James Darnley james.darnley
Thu Apr 22 15:29:34 CEST 2010


Since you guys can't decide on colours, how about some prefixes on messages?

Index: libavutil/log.c
===================================================================
--- libavutil/log.c	(revision 22900)
+++ libavutil/log.c	(working copy)
@@ -38,11 +38,23 @@
     static int count;
     static char line[1024], prev[1024];
     AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
+    char *message_prefix;
     if(level>av_log_level)
         return;
+    switch(level) {
+    case AV_LOG_PANIC:   message_prefix = "PANIC  ";
+                         break;
+    case AV_LOG_FATAL:   message_prefix = "FATAL  ";
+                         break;
+    case AV_LOG_ERROR:   message_prefix = "ERROR  ";
+                         break;
+    case AV_LOG_WARNING: message_prefix = "WARNING";
+                         break;
+    default:             message_prefix = "       ";
+    }
 #undef fprintf
     if(print_prefix && avc) {
-        snprintf(line, sizeof(line), "[%s @ %p]", avc->item_name(ptr), ptr);
+        snprintf(line, sizeof(line), "[%s %s @ %p]", message_prefix,
avc->item_name(ptr), ptr);
     }else
         line[0]=0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prefixes.diff
Type: application/octet-stream
Size: 1052 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100422/287d56b7/attachment.obj>



More information about the ffmpeg-devel mailing list