func (l *LogManager) RegisterLogger(name string, logger XLogger) (err error) {
	l.lock.Lock()
	defer l.lock.Unlock()
	_, ok := l.loggers[name]
	if ok {
		err = fmt.Errorf("duplicate logger[%s]", name)
		return
	}
	l.loggers[name] = &LogInstance{
		logger:  logger,
		enable:  false,
		initial: false,
	}
	return
}
RegisterLogger register a logger
package xlog
import (
	"errors"
	"fmt"
	"sync"
)
type LogInstance struct {
	logger  XLogger
	enable  bool
	initial bool
	source  string
}
type LogManager struct {
	loggers map[string]*LogInstance
	lock    sync.RWMutex
}
func CreateLogManager(name string, config map[string]string, source ...string) (*LogManager, error) {
	mgr := &LogManager{
		loggers: make(map[string]*LogInstance),
	}
	if err := mgr.Init(name, config, source...); err != nil {
		return nil, err
	}
	return mgr, nil
}
func (l *LogManager) Init(name string, config map[string]string, source ...string) (err error) {
	if err := l.RegisterLogger("console", NewXConsoleLog()); err != nil {
		return err
	}
	if err := l.RegisterLogger("file", NewXFileLog()); err != nil {
		return err
	}
	err = l.initLogger(name, config)
	for _, v := range l.loggers {
		if v.logger == nil || !v.enable {
			continue
		}
		if v.source == "auto" {
			v.enable = false
		}
	}
	return
}
func (l *LogManager) initLogger(name string, config map[string]string, source ...string) (err error) {
	l.lock.Lock()
	defer l.lock.Unlock()
	instance, ok := l.loggers[name]
	if !ok {
		err = fmt.Errorf("not found logger[%s]", name)
		return
	}
	err = instance.logger.Init(config)
	if err != nil {
		return
	}
	if len(source) > 0 {
		instance.source = source[0]
	} else {
		instance.source = ""
	}
	instance.enable = true
	instance.initial = true
	return
}