func (cl *CoLog) NewLogger() *log.Logger {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	return log.New(cl, "", 0)
}
NewLogger returns a colog-enabled logger
package colog
import (
	"bytes"
	"errors"
	"fmt"
	"io"
	"log"
	"os"
	"runtime"
	"sync"
	"time"
)
var std = NewCoLog(os.Stderr, "", 0)
type CoLog struct {
	mu           sync.Mutex
	host         string
	prefix       string
	minLevel     Level
	defaultLevel Level
	headers      HeaderMap
	extractor    Extractor
	formatter    Formatter
	customFmt    bool
	parseFields  bool
	fixed        Fields
	hooks        hookPool
	out          io.Writer
}
type Entry struct {
	Level   Level      
	Time    time.Time  
	Host    string     
	Prefix  string     
	File    string     
	Line    int        
	Message []byte     
	Fields  Fields     
}
type Level uint8
type LevelMap map[Level][]byte
type HeaderMap map[string]Level
type hookPool map[Level][]Hook
type Fields map[string]interface{}
const (
	unknown Level = iota
	LTrace
	LDebug
	LInfo
	LWarning
	LError
	LAlert
)
func (level Level) String() string {
	switch level {
	case LTrace:
		return "trace"
	case LDebug:
		return "debug"
	case LInfo:
		return "info"
	case LWarning:
		return "warning"
	case LError:
		return "error"
	case LAlert:
		return "alert"
	}
	return "unknown"
}
var initialMinLevel = LTrace
var initialDefaultLevel = LInfo
var defaultHeaders = HeaderMap{
	"t: ":       LTrace,
	"trc: ":     LTrace,
	"trace: ":   LTrace,
	"d: ":       LDebug,
	"dbg: ":     LDebug,
	"debug: ":   LDebug,
	"i: ":       LInfo,
	"inf: ":     LInfo,
	"info: ":    LInfo,
	"w: ":       LWarning,
	"wrn: ":     LWarning,
	"warn: ":    LWarning,
	"warning: ": LWarning,
	"e: ":       LError,
	"err: ":     LError,
	"error: ":   LError,
	"a: ":       LAlert,
	"alr: ":     LAlert,
	"alert: ":   LAlert,
	"panic: ":   LAlert,
}
func NewCoLog(out io.Writer, prefix string, flags int) *CoLog {
	cl := new(CoLog)
	cl.minLevel = initialMinLevel
	cl.defaultLevel = initialDefaultLevel
	cl.hooks = make(hookPool)
	cl.fixed = make(Fields)
	cl.headers = defaultHeaders
	cl.prefix = prefix
	cl.formatter = &StdFormatter{Flag: flags}
	cl.extractor = &StdExtractor{}
	cl.SetOutput(out)
	if host, err := os.Hostname(); err != nil {
		cl.host = host
	}
	return cl
}
func Register() {
	if !std.customFmt {
		std.formatter.SetFlags(log.Flags())
	}
	if log.Prefix() != "" && std.prefix == "" {
		std.SetPrefix(log.Prefix())
	}
	log.SetPrefix("")
	log.SetFlags(0)
	log.SetOutput(std)
}
func (cl *CoLog) AddHook(hook Hook) {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	for _, l := range hook.Levels() {
		cl.hooks[l] = append(cl.hooks[l], hook)
	}
}
func (cl *CoLog) SetHost(host string) {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	cl.host = host
}
func (cl *CoLog) SetPrefix(prefix string) {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	cl.prefix = prefix
}
func (cl *CoLog) SetMinLevel(l Level) {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	cl.minLevel = l
}
func (cl *CoLog) SetDefaultLevel(l Level) {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	cl.defaultLevel = l
}
func (cl *CoLog) ParseFields(active bool) {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	cl.parseFields = active
}
func (cl *CoLog) SetHeaders(headers HeaderMap) {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	cl.headers = headers
}
func (cl *CoLog) AddHeader(header string, level Level) {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	cl.headers[header] = level
}
func (cl *CoLog) SetFormatter(f Formatter) {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	cl.customFmt = true
	cl.formatter = f
}
func (cl *CoLog) SetExtractor(ex Extractor) {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	cl.extractor = ex
}
func (cl *CoLog) FixedValue(key string, value interface{}) {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	cl.fixed[key] = value
}
func (cl *CoLog) ClearFixedValues() {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	cl.fixed = make(Fields)
}
func (cl *CoLog) Flags() int {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	if cl.formatter == nil {
		return 0
	}
	return cl.formatter.Flags()
}
func (cl *CoLog) SetFlags(flags int) {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	if cl.formatter == nil {
		return
	}
	cl.formatter.SetFlags(flags)
}
func (cl *CoLog) SetOutput(w io.Writer) {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	cl.out = w
	if _, ok := cl.formatter.(ColorFormatter); ok {
		cl.formatter.(ColorFormatter).ColorSupported(cl.colorSupported())
	}
}