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

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