2024-12-15 08:39:18 +00:00
|
|
|
package logger
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sync"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
instance *ZapLogger
|
|
|
|
once sync.Once
|
|
|
|
)
|
|
|
|
|
|
|
|
// Logger определяет интерфейс для логгера
|
|
|
|
type Logger interface {
|
2024-12-16 16:34:51 +00:00
|
|
|
Debug(msg string, fields ...map[string]interface{})
|
|
|
|
Info(msg string, fields ...map[string]interface{})
|
|
|
|
Warn(msg string, fields ...map[string]interface{})
|
|
|
|
Error(msg string, fields ...map[string]interface{})
|
|
|
|
Fatal(msg string, fields ...map[string]interface{})
|
2024-12-15 08:39:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func GetLogger() *ZapLogger {
|
|
|
|
once.Do(func() {
|
|
|
|
instance = NewZapLogger()
|
|
|
|
})
|
|
|
|
return instance
|
|
|
|
}
|