Call klog.InitFlags to enable logging

This commit is contained in:
Justin SB 2019-05-06 01:33:40 -04:00
parent 76d03b3f71
commit 044395c588
No known key found for this signature in database
GPG Key ID: 8DEC5C8217494E37
5 changed files with 13 additions and 1 deletions

View File

@ -5,7 +5,10 @@ go_library(
srcs = ["main.go"],
importpath = "k8s.io/kops/channels/cmd/channels",
visibility = ["//visibility:private"],
deps = ["//channels/pkg/cmd:go_default_library"],
deps = [
"//channels/pkg/cmd:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
],
)
go_binary(

View File

@ -20,10 +20,13 @@ import (
"fmt"
"os"
"k8s.io/klog"
"k8s.io/kops/channels/pkg/cmd"
)
func main() {
klog.InitFlags(nil)
f := &cmd.DefaultFactory{}
if err := cmd.Execute(f, os.Stdout); err != nil {
fmt.Fprintf(os.Stderr, "\n%v\n", err)

View File

@ -102,6 +102,8 @@ func Execute() {
func init() {
cobra.OnInitialize(initConfig)
klog.InitFlags(nil)
factory := util.NewFactory(&rootCommand.FactoryOptions)
rootCommand.factory = factory

View File

@ -35,6 +35,8 @@ const (
)
func main() {
klog.InitFlags(nil)
gitVersion := ""
if kops.GitVersion != "" {
gitVersion = " (git-" + kops.GitVersion + ")"

View File

@ -48,6 +48,8 @@ var (
)
func main() {
klog.InitFlags(nil)
fmt.Printf("protokube version %s\n", BuildVersion)
if err := run(); err != nil {