func (i *Ilog) MinPrintLevel() int {
	i.mut.Lock()
	defer i.mut.Unlock()
	return i.minPrintLevel
}
MinPrintLevel returns the minimum required print level.
package ilog
import (
	"fmt"
	"os"
	"sync"
	"time"
	"github.com/fatih/color"
)
var StdLog = New()
type Logger interface {
	level() int
	Logln(a ...interface{})
	Logf(f string, a ...interface{})
}
var (
	Debug = ForLevelPrefix(-2, "DEBU")
	Info = ForLevelPrefix(-1, "INFO")
	Warn = ForLevelPrefix(0, "WARN")
	Error = ForLevelPrefix(1, "ERRO")
)
type Bough struct {
	Level   int
	Prefix  string
	Message string
}
type PrintFunc func(b Bough)
func ForLevelPrefix(l int, prefix string) Logger {
	return StdLog.ForLevelPrefix(l, prefix)
}
type Ilog struct {
	mut sync.Mutex  
	print         PrintFunc
	minPrintLevel int
}
func ColorfulPrintFunc(b Bough) {
	prefixPrinter := fmt.Sprintf
	switch {
	case b.Level == 0:
		prefixPrinter = color.YellowString
	case b.Level > 0:
		prefixPrinter = color.RedString
	case b.Level == -1:
		prefixPrinter = color.BlueString
	}
	fmt.Fprintf(os.Stderr, "[%s] %s %s\n", time.Now().Format(time.Stamp), prefixPrinter(b.Prefix), b.Message)
}
func New() *Ilog {
	return &Ilog{}
}
func (i *Ilog) Send(b Bough) {
	i.mut.Lock()
	defer i.mut.Unlock()
	if b.Level >= i.minPrintLevel {
		f := i.print
		if f == nil {
			f = ColorfulPrintFunc
		}
		f(b)
	}
}
func (i *Ilog) SetPrintFunc(f PrintFunc) {
	i.mut.Lock()
	defer i.mut.Unlock()
	i.print = f
}
func (i *Ilog) PrintFunc() PrintFunc {
	i.mut.Lock()
	defer i.mut.Unlock()
	return i.print
}
func (i *Ilog) SetMinPrintLevel(level int) {
	i.mut.Lock()
	defer i.mut.Unlock()
	i.minPrintLevel = level
}