From 1dcd75f8a27af4ac68eb19af10629c8ddc7a0129 Mon Sep 17 00:00:00 2001 From: SimFG <1142838399@qq.com> Date: Thu, 23 Jun 2022 19:36:33 +0800 Subject: [PATCH] config: Add the default case when failing to parse the log rotate config json Make sure that the `setupLogRotation` function must return the error when failing parse json. Signed-off-by: SimFG <1142838399@qq.com> --- server/embed/config_logging.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/embed/config_logging.go b/server/embed/config_logging.go index 2da893992..6195d54ff 100644 --- a/server/embed/config_logging.go +++ b/server/embed/config_logging.go @@ -272,6 +272,8 @@ func setupLogRotation(logOutputs []string, logRotateConfigJSON string) error { return fmt.Errorf("improperly formatted log rotation config: %v", err) case errors.As(err, &unmarshalTypeError): return fmt.Errorf("invalid log rotation config: %v", err) + default: + return fmt.Errorf("fail to unmarshal log rotation config: %v", err) } } zap.RegisterSink("rotate", func(u *url.URL) (zap.Sink, error) {