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

Måns Rullgård mans
Thu Apr 22 15:35:33 CEST 2010


James Darnley <james.darnley at gmail.com> writes:

> 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 = "       ";
> +    }

I think a table indexed by level>>3 would be better.  With appropriate
range checks of course.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list