Melora Hugues
ce8bd4ee7c
Start the process of replacing dex with zitadel, this commit is absolutely not prod-ready, basically we just added zitatel, and the necessary elements to make it work to at least getting a client from the DB - replace logrus with zap - start our own storage for the users - instanciate zitaled on start - allow getting client using the ID from the DB
28 lines
555 B
Go
28 lines
555 B
Go
package logger
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"go.uber.org/zap"
|
|
"go.uber.org/zap/zapcore"
|
|
)
|
|
|
|
var L *zap.SugaredLogger
|
|
|
|
func Init(level zap.AtomicLevel) {
|
|
conf := zap.Config{
|
|
Level: level,
|
|
Encoding: "console",
|
|
OutputPaths: []string{"stdout"},
|
|
ErrorOutputPaths: []string{"stderr"},
|
|
EncoderConfig: zap.NewDevelopmentEncoderConfig(),
|
|
}
|
|
conf.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
|
|
|
|
if l, err := conf.Build(); err != nil {
|
|
panic(fmt.Errorf("failed to init logger: %w", err))
|
|
} else {
|
|
L = l.Sugar()
|
|
}
|
|
|
|
}
|