17 lines
251 B
Go
17 lines
251 B
Go
package logger
|
|
|
|
import (
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func NewLogger(debug bool) (*zap.SugaredLogger, error) {
|
|
log, err := zap.NewProduction()
|
|
if debug {
|
|
log, err = zap.NewDevelopment()
|
|
}
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return log.Sugar(), nil
|
|
}
|