package impl_localfile

import "sync"

func (l *Logger) InfoLog(format string, args ...interface{}) {
	l.log(getLog(format, args...), info, true)
}

func (l *Logger) WarnLog(format string, args ...interface{}) {
	l.log(getLog(format, args...), warn, true)
}

func (l *Logger) DebugLog(format string, args ...interface{}) {
	l.log(getLog(format, args...), debug, true)
}

func (l *Logger) ErrorLog(format string, args ...interface{}) {
	l.log(getLog(format, args...), _error, true)
}

func (l *Logger) FatalLog(format string, args ...interface{}) {
	l.log(getLog(format, args...), fatal, true)
}

func (l *Logger) CloseLog(waitFinish bool) {
	wg := sync.WaitGroup{}

	// 关闭所有的file
	for _, logger := range l.loggerMap {
		wg.Add(1)
		go logger.Close(&wg, waitFinish)
	}

	wg.Wait()
}
