can completely disable colors on text formatter

This commit is contained in:
Matt Price 2014-08-13 13:30:25 -04:00
parent d1c2d610bd
commit af9d545893
1 changed files with 3 additions and 2 deletions

View File

@ -27,6 +27,7 @@ func miniTS() int {
type TextFormatter struct {
// Set to true to bypass checking for a TTY before outputting colors.
ForceColors bool
DisableColors bool
}
func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
@ -34,7 +35,7 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
prefixFieldClashes(entry)
if f.ForceColors || IsTerminal() {
if (f.ForceColors || IsTerminal()) && !DisableColors {
levelText := strings.ToUpper(entry.Data["level"].(string))[0:4]
levelColor := blue