Skip to content

Commit

Permalink
Change default log level to 2
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Büringer [email protected]
  • Loading branch information
sbueringer committed Jul 31, 2023
1 parent a0f2568 commit a6317fb
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 1 deletion.
5 changes: 5 additions & 0 deletions bootstrap/kubeadm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ func main() {
InitFlags(pflag.CommandLine)
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
// Set log level 2 as default.
if err := pflag.CommandLine.Set("v", "2"); err != nil {
setupLog.Error(err, "failed to set log level: %v")
os.Exit(1)
}
pflag.Parse()

if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {
Expand Down
5 changes: 5 additions & 0 deletions controlplane/kubeadm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ func main() {
InitFlags(pflag.CommandLine)
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
// Set log level 2 as default.
if err := pflag.CommandLine.Set("v", "2"); err != nil {
setupLog.Error(err, "failed to set log level: %v")
os.Exit(1)
}
pflag.Parse()

if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/developer/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ for log levels; as a small integration on the above guidelines we would like to
the code; a person reading those logs usually has deep knowledge of the codebase.
- Don’t use verbosity higher than 5.

Ideally, in a future release of Cluster API we will switch to use 2 as a default verbosity (currently it is 0) for all the Cluster API
We are using log level 2 as a default verbosity for all core Cluster API
controllers as recommended by the Kubernetes guidelines.

## Trade-offs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ func main() {
InitFlags(pflag.CommandLine)
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
// Set log level 2 as default.
if err := pflag.CommandLine.Set("v", "2"); err != nil {
setupLog.Error(err, "failed to set log level: %v")
os.Exit(1)
}
pflag.Parse()

// Validates logs flags using Kubernetes component-base machinery and applies them
Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ func main() {
InitFlags(pflag.CommandLine)
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
// Set log level 2 as default.
if err := pflag.CommandLine.Set("v", "2"); err != nil {
setupLog.Error(err, "failed to set log level: %v")
os.Exit(1)
}
pflag.Parse()

if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {
Expand Down
5 changes: 5 additions & 0 deletions test/extension/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ func main() {
InitFlags(pflag.CommandLine)
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
// Set log level 2 as default.
if err := pflag.CommandLine.Set("v", "2"); err != nil {
setupLog.Error(err, "failed to set log level: %v")
os.Exit(1)
}
pflag.Parse()

// Validates logs flags using Kubernetes component-base machinery and apply them
Expand Down
5 changes: 5 additions & 0 deletions test/infrastructure/docker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ func main() {
initFlags(pflag.CommandLine)
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
// Set log level 2 as default.
if err := pflag.CommandLine.Set("v", "2"); err != nil {
setupLog.Error(err, "failed to set log level: %v")
os.Exit(1)
}
pflag.Parse()

if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {
Expand Down
5 changes: 5 additions & 0 deletions test/infrastructure/inmemory/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ func main() {
InitFlags(pflag.CommandLine)
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
// Set log level 2 as default.
if err := pflag.CommandLine.Set("v", "2"); err != nil {
setupLog.Error(err, "failed to set log level: %v")
os.Exit(1)
}
pflag.Parse()

if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {
Expand Down

0 comments on commit a6317fb

Please sign in to comment.