Updated:

less than 1 minute read

설명


예제

  • 코드
     package main
    	
     import (
         "errors"
    	
         "k8s.io/klog/v2"
     )
    	
     func main() {
         defer klog.Flush()
    	
         klog.Infof("%s test", "Infof")
         klog.Warningf("%s test", "Warningf")
         klog.Errorf("%s test", "Errorf")
    	
         klog.InfoS("message", "a", "aaa", "1", 111)
    	
         err := errors.New("error occur")
         klog.ErrorS(err, "message", "a", "aaa", "1", 111)
     }
    
  • 결과
     I0909 17:17:07.683384    3115 test.go:11] Infof test
     W0909 17:17:07.683605    3115 test.go:12] Warningf test
     E0909 17:17:07.683613    3115 test.go:13] Errorf test
     I0909 17:17:07.683792    3115 test.go:15] "message" a="aaa" 1=111
     E0909 17:17:07.683815    3115 test.go:18] "message" err="error occur" a="aaa" 1=111