summaryrefslogtreecommitdiffhomepage
path: root/pkg/server/server.go
diff options
context:
space:
mode:
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 (