func NewLogger(name string, level Level, handlers []Handler, bufferLength int) (l *Logger) {
	l = &Logger{
		Name:          name,
		Level:         level,
		Handlers:      handlers,
		buffer:        ring.New(bufferLength),
		stateChannel:  make(chan uint8, 0),
		recordChannel: make(chan *Record, 2048),
		lock:          sync.RWMutex{},
		countOut:      0,
		countIn:       0,
	}
	go l.run()
	if name == "default" {
		defaultLogger = l
	}
	lock.Lock()
	loggers[name] = l
	lock.Unlock()
	return
}
func NewLogger(name string, level Level, handlers []Handler, bufferLength int) (l *Logger) {
	l = &Logger{
		Name:          name,
		Level:         level,
		Handlers:      handlers,
		buffer:        ring.New(bufferLength),
		stateChannel:  make(chan uint8, 0),
		recordChannel: make(chan *Record, 2048),
		lock:          sync.RWMutex{},
		countOut:      0,
		countIn:       0,
	}
	go l.run()
	if name == "default" {
		defaultLogger = l
	}
	lock.Lock()
	loggers[name] = l
	lock.Unlock()
	return
}
// NewLogger creates and returns new logger instance with provided name, log level,
// handlers and buffer length.
// If a logger with the same name already exists, it will be replaced with a new one.
// Log level is lowest level or log record that this logger will handle.
// Log records (above defined log level) will be passed to all log handlers for processing.