Updating versions and changing log system
Some checks failed
continuous-integration/drone Build encountered an error

This commit is contained in:
2023-02-20 23:54:02 +01:00
parent 16c57cc424
commit c4a97644ed
14 changed files with 324 additions and 143 deletions

View File

@@ -1,12 +1,10 @@
package utils
import (
"log"
"math/rand"
"strings"
"time"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"golang.org/x/crypto/bcrypt"
)
@@ -58,24 +56,3 @@ func SyslogTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder) {
enc.AppendString(t.Format("2006-01-02 15:04:05"))
}
func GetLog() *zap.SugaredLogger {
cfg := zap.NewProductionConfig()
cfg.Development = true
cfg.DisableCaller = false
cfg.DisableStacktrace = false
cfg.Encoding = "console" // "console" or "json"
cfg.EncoderConfig.EncodeTime = SyslogTimeEncoder
cfg.OutputPaths = []string{"stdout"}
cfg.ErrorOutputPaths = []string{"stderr"}
cfg.Level.SetLevel(zap.DebugLevel)
logger, err := cfg.Build()
if err != nil {
log.Panicf("Could not build logger, err: %v", err)
}
defer logger.Sync() // Flushes buffer, if any
log := logger.Sugar()
return log
}