-
Notifications
You must be signed in to change notification settings - Fork 450
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
- Loading branch information
1 parent
df2d066
commit fbe9d83
Showing
4 changed files
with
109 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,43 @@ | ||
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(level bgplog.LogLevel) { | ||
return | ||
} | ||
|
||
func (k bgpLogger) GetLevel() bgplog.LogLevel { | ||
return 0 | ||
} |