func (formatter *Formatter) SetMarkedColor(color Color) {
	formatter.lock.Lock()
	defer formatter.lock.Unlock()
	formatter.colorMgr.SetMarkedColor(color)
}
SetMarkedColor sets the color of a log that is marked.
package text
import (
	"regexp"
	"strings"
	"sync"
	"github.com/gxlog/gxlog/iface"
)
var headerRegexp = regexp.MustCompile("{{([^:%]*?)(?::([^%]*?))?(%.*?)?}}")
type Formatter struct {
	header     string
	minBufSize int
	coloring   bool
	colorMgr  *colorMgr
	appenders []*headerAppender
	suffix    string
	lock sync.Mutex
}
func New(config Config) *Formatter {
	config.setDefaults()
	formatter := &Formatter{
		minBufSize: config.MinBufSize,
		coloring:   config.Coloring,
		colorMgr:   newColorMgr(),
	}
	formatter.SetHeader(config.Header)
	formatter.MapColors(config.ColorMap)
	return formatter
}
func (formatter *Formatter) Header() string {
	formatter.lock.Lock()
	defer formatter.lock.Unlock()
	return formatter.header
}
func (formatter *Formatter) SetHeader(header string) {
	formatter.lock.Lock()
	defer formatter.lock.Unlock()
	formatter.header = header
	formatter.appenders = formatter.appenders[:0]
	var staticText string
	for header != "" {
		indexes := headerRegexp.FindStringSubmatchIndex(header)
		if indexes == nil {
			break
		}
		begin, end := indexes[0], indexes[1]
		staticText += header[:begin]
		element, property, fmtspec := extractElement(indexes, header)
		if formatter.addAppender(element, property, fmtspec, staticText) {
			staticText = ""
		}
		header = header[end:]
	}
	formatter.suffix = staticText + header
}
func (formatter *Formatter) MinBufSize() int {
	formatter.lock.Lock()
	defer formatter.lock.Unlock()
	return formatter.minBufSize
}
func (formatter *Formatter) SetMinBufSize(size int) {
	formatter.lock.Lock()
	defer formatter.lock.Unlock()
	if size == 0 {
		formatter.minBufSize = 256
	} else {
		formatter.minBufSize = size
	}
}
func (formatter *Formatter) Coloring() bool {
	formatter.lock.Lock()
	defer formatter.lock.Unlock()
	return formatter.coloring
}
func (formatter *Formatter) EnableColoring() {
	formatter.lock.Lock()
	defer formatter.lock.Unlock()
	formatter.coloring = true
}
func (formatter *Formatter) DisableColoring() {
	formatter.lock.Lock()
	defer formatter.lock.Unlock()
	formatter.coloring = false
}
func (formatter *Formatter) Color(level iface.Level) Color {
	formatter.lock.Lock()
	defer formatter.lock.Unlock()
	return formatter.colorMgr.Color(level)
}
func (formatter *Formatter) SetColor(level iface.Level, color Color) {
	formatter.lock.Lock()
	defer formatter.lock.Unlock()
	formatter.colorMgr.SetColor(level, color)
}
func (formatter *Formatter) MapColors(colorMap map[iface.Level]Color) {
	formatter.lock.Lock()
	defer formatter.lock.Unlock()
	formatter.colorMgr.MapColors(colorMap)
}
func (formatter *Formatter) MarkedColor() Color {
	formatter.lock.Lock()
	defer formatter.lock.Unlock()
	return formatter.colorMgr.MarkedColor()
}