26 lines
532 B
Go
26 lines
532 B
Go
package logger
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
var (
|
|
instance *ZapLogger
|
|
once sync.Once
|
|
)
|
|
|
|
// Logger определяет интерфейс для логгера
|
|
type Logger interface {
|
|
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{})
|
|
}
|
|
|
|
func GetLogger() *ZapLogger {
|
|
once.Do(func() {
|
|
instance = NewZapLogger()
|
|
})
|
|
return instance
|
|
}
|