-
Notifications
You must be signed in to change notification settings - Fork 449
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bgp): logger & enhance nadProvider config (#4352)
Signed-off-by: SkalaNetworks <[email protected]>
- Loading branch information
1 parent
46b8f56
commit 6bfbfe8
Showing
4 changed files
with
108 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package speaker | ||
|
||
import ( | ||
bgplog "github.com/osrg/gobgp/v3/pkg/log" | ||
"k8s.io/klog/v2" | ||
) | ||
|
||
// bgpLogger is a struct implementing the GoBGP logger interface | ||
// This is useful to inject our custom klog logger into the GoBGP speaker | ||
type bgpLogger struct{} | ||
|
||
func (k bgpLogger) Panic(msg string, fields bgplog.Fields) { | ||
klog.Fatalf("%s %v", msg, fields) | ||
} | ||
|
||
func (k bgpLogger) Fatal(msg string, fields bgplog.Fields) { | ||
klog.Fatalf("%s %v", msg, fields) | ||
} | ||
|
||
func (k bgpLogger) Error(msg string, fields bgplog.Fields) { | ||
klog.Errorf("%s %v", msg, fields) | ||
} | ||
|
||
func (k bgpLogger) Warn(msg string, fields bgplog.Fields) { | ||
klog.Warningf("%s %v", msg, fields) | ||
} | ||
|
||
func (k bgpLogger) Info(msg string, fields bgplog.Fields) { | ||
klog.Infof("%s %v", msg, fields) | ||
} | ||
|
||
func (k bgpLogger) Debug(msg string, fields bgplog.Fields) { | ||
klog.V(5).Infof("%s %v", msg, fields) | ||
} | ||
|
||
func (k bgpLogger) SetLevel(_ bgplog.LogLevel) { | ||
} | ||
|
||
func (k bgpLogger) GetLevel() bgplog.LogLevel { | ||
return 0 | ||
} |