Skip to content

Set logger verbosity level #167

@AMecea

Description

@AMecea

I'm trying to set logger verbosity from command line through -v flag, but how can I set the logging level? Currently, I'm initializing the logger like:

import logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
var log = logf.Log.WithName("sidecar")
func main () {
	logf.SetLogger(logf.ZapLogger(true))
        log.V(2).Info("msg")
}

but for any verbosity logging (V(2), V(3), V(4), ...) there is no output. Which is the best way to set the verbosity level for this logger?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/featureCategorizes issue or PR as related to a new feature.lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.priority/backlogHigher priority than priority/awaiting-more-evidence.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions