Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit 91b66bd

Browse files
authored
Fix up some logging configuration. (#477)
- Use the same logging config for all bootkube commands. - Make sure flag.Parse() is called, otherwise glog complains. I checked and cobra does not call flag.Parse().
1 parent 702d53e commit 91b66bd

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

cmd/bootkube/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package main
22

33
import (
4+
"flag"
45
"fmt"
56
"os"
67

78
"github.com/spf13/cobra"
89

10+
"github.com/kubernetes-incubator/bootkube/pkg/util"
911
"github.com/kubernetes-incubator/bootkube/pkg/version"
1012
)
1113

@@ -28,6 +30,10 @@ var (
2830
)
2931

3032
func main() {
33+
flag.Parse()
34+
util.InitLogs()
35+
defer util.FlushLogs()
36+
3137
cmdRoot.AddCommand(cmdVersion)
3238
if err := cmdRoot.Execute(); err != nil {
3339
fmt.Fprintln(os.Stderr, err)

cmd/bootkube/start.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ package main
22

33
import (
44
"errors"
5-
"flag"
65

76
"github.com/spf13/cobra"
87

98
"github.com/kubernetes-incubator/bootkube/pkg/bootkube"
10-
"github.com/kubernetes-incubator/bootkube/pkg/util"
119
)
1210

1311
var (
@@ -37,16 +35,10 @@ func runCmdStart(cmd *cobra.Command, args []string) error {
3735
AssetDir: startOpts.assetDir,
3836
PodManifestPath: startOpts.podManifestPath,
3937
})
40-
4138
if err != nil {
4239
return err
4340
}
4441

45-
// set in util init() func, but lets not depend on that
46-
flag.Set("logtostderr", "true")
47-
util.InitLogs()
48-
defer util.FlushLogs()
49-
5042
err = bk.Run()
5143
if err != nil {
5244
// Always report errors.

0 commit comments

Comments
 (0)