Skip to content

Commit

Permalink
Allow to force colored output.
Browse files Browse the repository at this point in the history
Patch by Etienne Buira, etienne d buira d lists a free d fr

Originally committed as revision 25888 to svn://svn.ffmpeg.org/ffmpeg/trunk
  • Loading branch information
Etienne Buira authored and cehoyos committed Dec 5, 2010
1 parent 35b0169 commit 1299834
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion doc/fftools-common-opts.texi
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Set the logging level used by the library.

By default the program logs to stderr, if coloring is supported by the
terminal, colors are used to mark errors and warnings. Log coloring
can be disabled setting the environment variable @env{NO_COLOR}.
can be disabled setting the environment variable @env{NO_COLOR}, or can
be forced setting the environment variable @env{FFMPEG_FORCE_COLOR}.

@end table
4 changes: 2 additions & 2 deletions libavutil/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ static void colored_fputs(int level, const char *str){
background = attr_orig & 0xF0;
}
#elif HAVE_ISATTY
use_color= getenv("TERM") && !getenv("NO_COLOR") && isatty(2);
use_color= !getenv("NO_COLOR") && (getenv("TERM") && isatty(2) || getenv("FFMPEG_FORCE_COLOR"));
#else
use_color= 0;
use_color= getenv("FFMPEG_FORCE_COLOR") && !getenv("NO_COLOR");
#endif
}

Expand Down

0 comments on commit 1299834

Please sign in to comment.