Skip to content

Commit

Permalink
Feat: add log args
Browse files Browse the repository at this point in the history
Signed-off-by: Yin Da <[email protected]>
  • Loading branch information
Somefive committed Sep 1, 2022
1 parent a3751c2 commit 33efc8a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/apiserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func main() {
if err != nil {
klog.Fatal(err)
}
config.AddLogFlags(cmd.Flags())
config.AddSecretFlags(cmd.Flags())
config.AddClusterProxyFlags(cmd.Flags())
config.AddProxyAuthorizationFlags(cmd.Flags())
Expand Down
31 changes: 31 additions & 0 deletions pkg/config/args_log.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Copyright 2022 The KubeVela Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package config

import (
"flag"

"github.com/spf13/pflag"
"k8s.io/klog/v2"
)

// AddLogFlags add log flags to command
func AddLogFlags(set *pflag.FlagSet) {
fs := flag.NewFlagSet("", 0)
klog.InitFlags(fs)
set.AddGoFlagSet(fs)
}

0 comments on commit 33efc8a

Please sign in to comment.