Skip to content

Commit

Permalink
Merge pull request #71 from chrislovecnm/glog-to-klog-cleanup
Browse files Browse the repository at this point in the history
Code Hygiene - glog to klog
  • Loading branch information
k8s-ci-robot authored Jun 14, 2019
2 parents d98d8ac + a4033db commit e153094
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions klog.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
//
// Basic examples:
//
// glog.Info("Prepare to repel boarders")
// klog.Info("Prepare to repel boarders")
//
// glog.Fatalf("Initialization failed: %s", err)
// klog.Fatalf("Initialization failed: %s", err)
//
// See the documentation for the V function for an explanation of these examples:
//
// if glog.V(2) {
// glog.Info("Starting transaction...")
// if klog.V(2) {
// klog.Info("Starting transaction...")
// }
//
// glog.V(2).Infoln("Processed", nItems, "elements")
// klog.V(2).Infoln("Processed", nItems, "elements")
//
// Log output is buffered and written periodically using Flush. Programs
// should call Flush before exiting to guarantee all log output is written.
Expand Down Expand Up @@ -827,7 +827,7 @@ func (l *loggingT) output(s severity, buf *buffer, file string, line int, alsoTo

// timeoutFlush calls Flush and returns when it completes or after timeout
// elapses, whichever happens first. This is needed because the hooks invoked
// by Flush may deadlock when glog.Fatal is called from a hook that holds
// by Flush may deadlock when klog.Fatal is called from a hook that holds
// a lock.
func timeoutFlush(timeout time.Duration) {
done := make(chan bool, 1)
Expand All @@ -838,7 +838,7 @@ func timeoutFlush(timeout time.Duration) {
select {
case <-done:
case <-time.After(timeout):
fmt.Fprintln(os.Stderr, "glog: Flush took longer than", timeout)
fmt.Fprintln(os.Stderr, "klog: Flush took longer than", timeout)
}
}

Expand Down Expand Up @@ -1094,9 +1094,9 @@ type Verbose bool
// The returned value is a boolean of type Verbose, which implements Info, Infoln
// and Infof. These methods will write to the Info log if called.
// Thus, one may write either
// if glog.V(2) { glog.Info("log this") }
// if klog.V(2) { klog.Info("log this") }
// or
// glog.V(2).Info("log this")
// klog.V(2).Info("log this")
// The second form is shorter but the first is cheaper if logging is off because it does
// not evaluate its arguments.
//
Expand Down
2 changes: 1 addition & 1 deletion klog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ func TestLogBacktraceAt(t *testing.T) {
// Need 2 appearances, one in the log header and one in the trace:
// log_test.go:281: I0511 16:36:06.952398 02238 log_test.go:280] we want a stack trace here
// ...
// github.com/glog/glog_test.go:280 (0x41ba91)
// k8s.io/klog/klog_test.go:280 (0x41ba91)
// ...
// We could be more precise but that would require knowing the details
// of the traceback format, which may not be dependable.
Expand Down

0 comments on commit e153094

Please sign in to comment.