Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
1d0b6ee5
Commit
1d0b6ee5
authored
Jan 14, 2015
by
Joe Beda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix up logging flags for kubectl.
parent
7ee32714
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
cmd.go
pkg/kubectl/cmd/cmd.go
+4
-0
logs.go
pkg/util/logs.go
+3
-2
pflag_import.go
pkg/util/pflag_import.go
+9
-0
No files found.
pkg/kubectl/cmd/cmd.go
View file @
1d0b6ee5
...
@@ -143,6 +143,10 @@ func (f *Factory) BindFlags(flags *pflag.FlagSet) {
...
@@ -143,6 +143,10 @@ func (f *Factory) BindFlags(flags *pflag.FlagSet) {
// any flags defined by external projects (not part of pflags)
// any flags defined by external projects (not part of pflags)
util
.
AddAllFlagsToPFlagSet
(
flags
)
util
.
AddAllFlagsToPFlagSet
(
flags
)
// This is necessary as github.com/spf13/cobra doesn't support "global"
// pflags currently. See https://github.com/spf13/cobra/issues/44.
util
.
AddPFlagSetToPFlagSet
(
pflag
.
CommandLine
,
flags
)
if
f
.
flags
!=
nil
{
if
f
.
flags
!=
nil
{
f
.
flags
.
VisitAll
(
func
(
flag
*
pflag
.
Flag
)
{
f
.
flags
.
VisitAll
(
func
(
flag
*
pflag
.
Flag
)
{
flags
.
AddFlag
(
flag
)
flags
.
AddFlag
(
flag
)
...
...
pkg/util/logs.go
View file @
1d0b6ee5
...
@@ -17,14 +17,15 @@ limitations under the License.
...
@@ -17,14 +17,15 @@ limitations under the License.
package
util
package
util
import
(
import
(
"flag"
"log"
"log"
"time"
"time"
"github.com/golang/glog"
"github.com/golang/glog"
flag
"github.com/spf13/pflag"
"github.com/spf13/pflag"
)
)
var
logFlushFreq
=
flag
.
Duration
(
"log_flush_frequency"
,
5
*
time
.
Second
,
"Maximum number of seconds between log flushes"
)
var
logFlushFreq
=
p
flag
.
Duration
(
"log_flush_frequency"
,
5
*
time
.
Second
,
"Maximum number of seconds between log flushes"
)
// TODO(thockin): This is temporary until we agree on log dirs and put those into each cmd.
// TODO(thockin): This is temporary until we agree on log dirs and put those into each cmd.
func
init
()
{
func
init
()
{
...
...
pkg/util/pflag_import.go
View file @
1d0b6ee5
...
@@ -87,3 +87,12 @@ func AddAllFlagsToPFlagSet(fs *pflag.FlagSet) {
...
@@ -87,3 +87,12 @@ func AddAllFlagsToPFlagSet(fs *pflag.FlagSet) {
func
AddAllFlagsToPFlags
()
{
func
AddAllFlagsToPFlags
()
{
AddFlagSetToPFlagSet
(
flag
.
CommandLine
,
pflag
.
CommandLine
)
AddFlagSetToPFlagSet
(
flag
.
CommandLine
,
pflag
.
CommandLine
)
}
}
// Merge all of the flags from fsFrom into fsTo.
func
AddPFlagSetToPFlagSet
(
fsFrom
*
pflag
.
FlagSet
,
fsTo
*
pflag
.
FlagSet
)
{
fsFrom
.
VisitAll
(
func
(
f
*
pflag
.
Flag
)
{
if
fsTo
.
Lookup
(
f
.
Name
)
==
nil
{
fsTo
.
AddFlag
(
f
)
}
})
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment