mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-14 04:02:16 -04:00
Changed TODO comments to reflect new ideas
new/better WIP TODOs wrote a note for fatal logging
This commit is contained in:
parent
0b0d3f7441
commit
d61f616c85
4 changed files with 9 additions and 8 deletions
|
@ -94,6 +94,9 @@ func (l *grpcLogger) Errorf(format string, args ...interface{}) {
|
|||
}
|
||||
|
||||
// TODO(miampf): Find a way to log on a fatal level, not an error level?
|
||||
// A ReplaceAttr function could be implemented in the logger package, however
|
||||
// this would increase it's complexity again (look [here](https://pkg.go.dev/log/slog#HandlerOptions)
|
||||
// for a reference implementation.
|
||||
|
||||
func (l *grpcLogger) Fatal(args ...interface{}) {
|
||||
var pcs [1]uintptr
|
||||
|
|
|
@ -50,12 +50,6 @@ import (
|
|||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// TODO(miampf): maybe rewrite as a solution for increasing log level?
|
||||
// WithIncreasedLevel returns a logger with increased logging level.
|
||||
// func (l *Logger) WithIncreasedLevel(level zapcore.Level) *Logger {
|
||||
// return &Logger{logger: l.getZapLogger().WithOptions(zap.IncreaseLevel(level)).Sugar()}
|
||||
// }
|
||||
|
||||
// ReplaceGRPCLogger replaces grpc's internal logger with the given logger.
|
||||
func ReplaceGRPCLogger(l *slog.Logger) {
|
||||
replaceGRPCLogger(l)
|
||||
|
|
|
@ -51,8 +51,11 @@ func (s *Server) Run(port string) error {
|
|||
|
||||
server := grpc.NewServer(logger.GetServerUnaryInterceptor(s.log.WithGroup("gRPC")))
|
||||
keyserviceproto.RegisterAPIServer(server, s)
|
||||
// TODO(miampf): Find out a good way to pass an increased Level to slog
|
||||
s.log.WithGroup("gRPC").WithIncreasedLevel(zapcore.WarnLevel).ReplaceGRPCLogger()
|
||||
// TODO(miampf): Find out a good way to pass an increased Level to slog.
|
||||
// A reference implementation for something like that exists
|
||||
// [here](https://pkg.go.dev/log/slog#Handler), however, this would
|
||||
// utilise structs in the logger package again which is not optimal.
|
||||
logger.ReplaceGRPCLogger(s.log.WithGroup("gRPC").WithIncreasedLevel(zapcore.WarnLevel))
|
||||
|
||||
// start the server
|
||||
s.log.Info("Starting Constellation key management service on %s", listener.Addr().String())
|
||||
|
|
|
@ -75,6 +75,7 @@ func main() {
|
|||
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
|
||||
"Enable leader election for controller manager. "+
|
||||
"Enabling this will ensure there is only one active controller manager.")
|
||||
// TODO(miampf): Find out what is going on here and reimplement it in log/slog.
|
||||
opts := zap.Options{
|
||||
Development: true,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue