Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: SetLogger via klog.SetLogger will output an unexpected newline #378

Merged
merged 1 commit into from
May 20, 2023

Commits on May 17, 2023

  1. fix: SetLogger via klog.SetLogger will output an unexpected newline

    klog always adds a newline to the msg. klog will work fine without klog.
    
    Set logr with klog.SetLogger, and klog will also pass the msg with the newline added to logr, which will result in an accidental newline being added.
    
    step1: klog.Info("hello world")
    step2: msg = msg + "\n"
    step3: stdout.W(msg) or logr.Info(msg[:len(msg)-1])
    
    fix kubernetes#370
    
    Signed-off-by: aimuz <[email protected]>
    aimuz committed May 17, 2023
    Configuration menu
    Copy the full SHA
    1e2789b View commit details
    Browse the repository at this point in the history