Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Add fluxd flag to set klog verbosity #2410

Merged
merged 1 commit into from
Aug 29, 2019
Merged

Add fluxd flag to set klog verbosity #2410

merged 1 commit into from
Aug 29, 2019

Conversation

stefanprodan
Copy link
Member

Fix: #2407

@stefanprodan stefanprodan requested a review from hiddeco August 28, 2019 11:46
@cristian-radu
Copy link

I just gave this a quick try by building cristianradu/flux:klog with

	// Explicitly initialize klog to enable stderr logging,
	// and parse our own flags.
	klogFlags := flag.NewFlagSet("klog", flag.ExitOnError)
	klog.InitFlags(klogFlags)
	verbosity := klogFlags.Lookup("v")
	verbosity.Value.Set(strconv.Itoa(*k8sVerbosity))

	klog.V(0).Infoln("klog level 0 message")
	klog.V(4).Infoln("klog level 4 message")

and running it with --k8s-verbosity=4

I0828 14:33:24.506799       6 main.go:211] klog level 0 message
Flag --registry-poll-interval has been deprecated, changed to --automation-interval, use that instead
ts=2019-08-28T14:33:24.506856362Z caller=main.go:241 version=klog-verbosity-63449f19-wip
ts=2019-08-28T14:33:24.506878212Z caller=main.go:370 msg="using in cluster config to connect to the cluster"

and I only got the level 0 message printed out :(

@stefanprodan
Copy link
Member Author

Ah I tested it by setting the default value to 4. I’ll fix it when I get home, the setter should be used after parse flags.

@stefanprodan
Copy link
Member Author

@cristian-radu please give it a try, it should work.

@cristian-radu
Copy link

yep, it works now 👍

@stefanprodan stefanprodan merged commit d7a8401 into master Aug 29, 2019
@stefanprodan stefanprodan deleted the klog-verbosity branch September 5, 2019 12:25
@hiddeco hiddeco modified the milestones: 1.15.0, 1.14.2 Oct 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fluxd - add ability to pass flags to klog
3 participants