added and used LevelHandler

This commit is contained in:
miampf 2024-01-10 13:44:25 +01:00
parent e40a99ca3a
commit 0e4d220c92
No known key found for this signature in database
GPG key ID: 376EAC0E5307A669
7 changed files with 56 additions and 24 deletions

View file

@ -16,7 +16,6 @@ import (
"github.com/edgelesssys/constellation/v2/internal/logger"
"github.com/edgelesssys/constellation/v2/upgrade-agent/internal/server"
"github.com/spf13/afero"
"go.uber.org/zap"
)
const (
@ -33,8 +32,7 @@ func main() {
if *gRPCDebug {
logger.ReplaceGRPCLogger(log.WithGroup("gRPC"))
} else {
// TODO(miampf): Find a good way to change log level dynamically
log.WithGroup("gRPC").WithIncreasedLevel(zap.WarnLevel).ReplaceGRPCLogger()
logger.ReplaceGRPCLogger(slog.New(logger.NewLevelHandler(slog.LevelWarn, log.Handler())).WithGroup("gRPC"))
}
handler := file.NewHandler(afero.NewOsFs())