mirror of https://github.com/mpv-player/mpv
mp_msg: use stdout for all output except status; put status on stderr
improves interaction with | less, | grep, ...
This commit is contained in:
parent
2f1bc6beb6
commit
020a954b60
4
mp_msg.c
4
mp_msg.c
|
@ -201,7 +201,7 @@ static void print_msg_module(FILE* stream, int mod)
|
||||||
void mp_msg_va(int mod, int lev, const char *format, va_list va)
|
void mp_msg_va(int mod, int lev, const char *format, va_list va)
|
||||||
{
|
{
|
||||||
char tmp[MSGSIZE_MAX];
|
char tmp[MSGSIZE_MAX];
|
||||||
FILE *stream = lev <= MSGL_WARN ? stderr : stdout;
|
FILE *stream = lev == MSGL_STATUS ? stderr : stdout;
|
||||||
static int header = 1;
|
static int header = 1;
|
||||||
// indicates if last line printed was a status line
|
// indicates if last line printed was a status line
|
||||||
static int statusline;
|
static int statusline;
|
||||||
|
@ -215,7 +215,7 @@ void mp_msg_va(int mod, int lev, const char *format, va_list va)
|
||||||
* status line, and does not end with a '\n'. If we're printing a normal
|
* status line, and does not end with a '\n'. If we're printing a normal
|
||||||
* line instead after the status one print '\n' to change line. */
|
* line instead after the status one print '\n' to change line. */
|
||||||
if (statusline && lev != MSGL_STATUS)
|
if (statusline && lev != MSGL_STATUS)
|
||||||
fprintf(stream, "\n");
|
fprintf(stderr, "\n");
|
||||||
statusline = lev == MSGL_STATUS;
|
statusline = lev == MSGL_STATUS;
|
||||||
|
|
||||||
if (header)
|
if (header)
|
||||||
|
|
Loading…
Reference in New Issue