summaryrefslogtreecommitdiffhomepage
path: root/pkg/server/server.go
diff options
context:
space:
mode:
authorSteve Shaw <shaw38@gmail.com>2020-10-21 13:25:38 -0400
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2020-11-06 21:15:10 +0900
commit393d82f955cf432fb41871275566e16fc7992e3e (patch)
tree3e5725c51f15264c96f8505d7d33b50436030b3a /pkg/server/server.go
parent01aa3f287bd41a3351396a303e60219b12a15475 (diff)
Adding gRPC support for modified logging level
Signed-off-by: Steve Shaw <shaw38@gmail.com>
Diffstat (limited to 'pkg/server/server.go')
-rw-r--r--pkg/server/server.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/server/server.go b/pkg/server/server.go
index ee58585f..5971bc6d 100644
--- a/pkg/server/server.go
+++ b/pkg/server/server.go
@@ -3796,6 +3796,22 @@ func (s *BgpServer) MonitorPeer(ctx context.Context, r *api.MonitorPeerRequest,
return nil
}
+func (s *BgpServer) SetLogLevel(ctx context.Context, r *api.SetLogLevelRequest) error {
+ prevLevel := log.GetLevel()
+ newLevel := log.Level(r.Level)
+ if prevLevel == newLevel {
+ log.WithFields(log.Fields{
+ "Topic": "Config",
+ }).Infof("Logging level unchanged -- level already set to %v", newLevel)
+ } else {
+ log.SetLevel(newLevel)
+ log.WithFields(log.Fields{
+ "Topic": "Config",
+ }).Infof("Logging level changed -- prev: %v, new: %v", prevLevel, newLevel)
+ }
+ return nil
+}
+
type watchEventType string
const (