[MPlayer-dev-eng] rfc, uniform labeling of messages?

Oded Shimon ods15 at ods15.dyndns.org
Wed Apr 26 07:37:58 CEST 2006


On Wed, Apr 26, 2006 at 01:18:56AM -0400, Reynaldo H. Verdejo Pinochet wrote:
> Ok, there is a huge bunch of help messages prefixed in no known
> form whatsoever but  almost all they use some variation of [foobar],
> [im this module]. etc. Well, even tho this could be a nono from the
> start, attached patch makes all message have a prefix stating what
> module they where generated from. just for you to see if it fits
> your eyes. who knows, maybe we can put some order on the message
> spitting chaos mplayer is.

I'm pro. Especially thanks to new -msglevel .

> @@ -65,7 +78,10 @@
>  void mp_msg(int mod, int lev, const char *format, ... ){
>      va_list va;
>      char tmp[MSGSIZE_MAX];
> -    
> +   	char label[MSG_LABEL_LENGTH+2];
> +
> +	snprintf(label, MSG_LABEL_LENGTH+2, "%-12s| ", MSG_LABEL[mod]);

snprintf(label, MSG_LABEL_LENGTH+2, "%-*s| ", MSG_LABEL[mod], MSG_LABEL_LENGTH);

>      if (!mp_msg_test(mod, lev)) return; // do not display
>      va_start(va, format);
>      vsnprintf(tmp, MSGSIZE_MAX, format, va);
> @@ -187,8 +203,10 @@
>      }
>  #endif
>      if (lev <= MSGL_WARN){
> +	fprintf(stderr, "%s", label);

Take consideration of MP_MSG_COLOR (yes I actually use it), you will get 
the label printed twice.
Another thing to consider is overflowing 80 width consoles, especially 
status line. Also the status line (sometimes) uses spaces to blank to end 
of line, and it assumes it doesn't have a header changing its width.

- ods15




More information about the MPlayer-dev-eng mailing list