func Errorf(format string, params ...interface{}) error {
	pkgOperationsMutex.Lock()
	defer pkgOperationsMutex.Unlock()
	message := newLogFormattedMessage(format, params)
	Current.errorWithCallDepth(staticFuncCallDepth, message)
	return errors.New(message.String())
}
Errorf formats message according to format specifier and writes to default logger with log level = Error
package seelog
import (
	"errors"
	"fmt"
	"sync"
	"time"
)
const (
	staticFuncCallDepth = 3  
	loggerFuncCallDepth = 3
)
var Current LoggerInterface
var Default LoggerInterface
var Disabled LoggerInterface
var pkgOperationsMutex *sync.Mutex
func init() {
	pkgOperationsMutex = new(sync.Mutex)
	var err error
	if Default == nil {
		Default, err = LoggerFromConfigAsBytes([]byte("<seelog />"))
	}
	if Disabled == nil {
		Disabled, err = LoggerFromConfigAsBytes([]byte("<seelog levels=\"off\"/>"))
	}
	if err != nil {
		panic(fmt.Sprintf("Seelog couldn't start. Error: %s", err.Error()))
	}
	Current = Default
}
func createLoggerFromConfig(config *logConfig) (LoggerInterface, error) {
	if config.LogType == syncloggerTypeFromString {
		return newSyncLogger(config), nil
	} else if config.LogType == asyncLooploggerTypeFromString {
		return newAsyncLoopLogger(config), nil
	} else if config.LogType == asyncTimerloggerTypeFromString {
		logData := config.LoggerData
		if logData == nil {
			return nil, errors.New("Async timer data not set!")
		}
		asyncInt, ok := logData.(asyncTimerLoggerData)
		if !ok {
			return nil, errors.New("Invalid async timer data!")
		}
		logger, err := newAsyncTimerLogger(config, time.Duration(asyncInt.AsyncInterval))
		if !ok {
			return nil, err
		}
		return logger, nil
	} else if config.LogType == adaptiveLoggerTypeFromString {
		logData := config.LoggerData
		if logData == nil {
			return nil, errors.New("Adaptive logger parameters not set!")
		}
		adaptData, ok := logData.(adaptiveLoggerData)
		if !ok {
			return nil, errors.New("Invalid adaptive logger parameters!")
		}
		logger, err := newAsyncAdaptiveLogger(
			config,
			time.Duration(adaptData.MinInterval),
			time.Duration(adaptData.MaxInterval),
			adaptData.CriticalMsgCount,
		)
		if err != nil {
			return nil, err
		}
		return logger, nil
	}
	return nil, errors.New("Invalid config log type/data")
}
func UseLogger(logger LoggerInterface) error {
	if logger == nil {
		return errors.New("Logger can not be nil")
	}
	pkgOperationsMutex.Lock()
	defer pkgOperationsMutex.Unlock()
	oldLogger := Current
	Current = logger
	if oldLogger != nil {
		oldLogger.Flush()
	}
	return nil
}
func ReplaceLogger(logger LoggerInterface) error {
	if logger == nil {
		return errors.New("Logger can not be nil")
	}
	pkgOperationsMutex.Lock()
	defer pkgOperationsMutex.Unlock()
	defer func() {
		if err := recover(); err != nil {
			reportInternalError(fmt.Errorf("Recovered from panic during ReplaceLogger: %s", err))
		}
	}()
	if Current == Default {
		Current.Flush()
	} else if Current != nil && !Current.Closed() && Current != Disabled {
		Current.Flush()
		Current.Close()
	}
	Current = logger
	return nil
}
func Tracef(format string, params ...interface{}) {
	pkgOperationsMutex.Lock()
	defer pkgOperationsMutex.Unlock()
	Current.traceWithCallDepth(staticFuncCallDepth, newLogFormattedMessage(format, params))
}
func Debugf(format string, params ...interface{}) {
	pkgOperationsMutex.Lock()
	defer pkgOperationsMutex.Unlock()
	Current.debugWithCallDepth(staticFuncCallDepth, newLogFormattedMessage(format, params))
}
func Infof(format string, params ...interface{}) {
	pkgOperationsMutex.Lock()
	defer pkgOperationsMutex.Unlock()
	Current.infoWithCallDepth(staticFuncCallDepth, newLogFormattedMessage(format, params))
}
func Warnf(format string, params ...interface{}) error {
	pkgOperationsMutex.Lock()
	defer pkgOperationsMutex.Unlock()
	message := newLogFormattedMessage(format, params)
	Current.warnWithCallDepth(staticFuncCallDepth, message)
	return errors.New(message.String())
}