summaryrefslogtreecommitdiffhomepage
path: root/pkg/server
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/server')
-rw-r--r--pkg/server/grpc_server.go4
-rw-r--r--pkg/server/server.go16
2 files changed, 20 insertions, 0 deletions
diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go
index a9f621fb..25c8495e 100644
--- a/pkg/server/grpc_server.go
+++ b/pkg/server/grpc_server.go
@@ -1772,3 +1772,7 @@ func (s *server) StopBgp(ctx context.Context, r *api.StopBgpRequest) (*empty.Emp
func (s *server) GetTable(ctx context.Context, r *api.GetTableRequest) (*api.GetTableResponse, error) {
return s.bgpServer.GetTable(ctx, r)
}
+
+func (s *server) SetLogLevel(ctx context.Context, r *api.SetLogLevelRequest) (*empty.Empty, error) {
+ return &empty.Empty{}, s.bgpServer.SetLogLevel(ctx, r)
+}
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 (