Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
language: go
go_import_path: k8s.io/klog
go_import_path: k8s.io/klog/v2
dist: xenial
go:
- 1.9.x
- 1.10.x
- 1.11.x
- 1.12.x
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add 1.13.x?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

- 1.13.x
script:
- go get -t -v ./...
- diff -u <(echo -n) <(gofmt -d .)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ How to use klog
- If you want to redirect everything logged using klog somewhere else (say syslog!), you can use `klog.SetOutput()` method and supply a `io.Writer`. (See `examples/set_output/usage_set_output.go`)
- For more logging conventions (See [Logging Conventions](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md))

**NOTE**: please use the newer go versions that support semantic import versioning in modules, ideally go 1.11.4 or greater.

### Coexisting with glog
This package can be used side by side with glog. [This example](examples/coexist_glog/coexist_glog.go) shows how to initialize and syncronize flags from the global `flag.CommandLine` FlagSet. In addition, the example makes use of stderr as combined output by setting `alsologtostderr` (or `logtostderr`) to `true`.

Expand Down
2 changes: 1 addition & 1 deletion examples/coexist_glog/coexist_glog.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"flag"

"github.com/golang/glog"
"k8s.io/klog"
"k8s.io/klog/v2"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions examples/klogr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"flag"

"k8s.io/klog"
"k8s.io/klog/klogr"
"k8s.io/klog/v2"
"k8s.io/klog/v2/klogr"
)

type myError struct {
Expand Down
2 changes: 1 addition & 1 deletion examples/log_file/usage_log_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"flag"
"k8s.io/klog"
"k8s.io/klog/v2"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/set_output/usage_set_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"flag"
"fmt"
"k8s.io/klog"
"k8s.io/klog/v2"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module k8s.io/klog
module k8s.io/klog/v2

go 1.12

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/internal/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"fmt"
"os"

"k8s.io/klog"
"k8s.io/klog/v2"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion klog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func TestHeaderWithDir(t *testing.T) {
pid = 1234
Info("test")
var line int
format := "I0102 15:04:05.067890 1234 klog/klog_test.go:%d] test\n"
format := "I0102 15:04:05.067890 1234 v2/klog_test.go:%d] test\n"
n, err := fmt.Sscanf(contents(infoLog), format, &line)
if n != 1 || err != nil {
t.Errorf("log format error: %d elements, error %s:\n%s", n, err, contents(infoLog))
Expand Down
2 changes: 1 addition & 1 deletion klogr/klogr.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"sort"

"github.com/go-logr/logr"
"k8s.io/klog"
"k8s.io/klog/v2"
)

// New returns a logr.Logger which is implemented by klog.
Expand Down
2 changes: 1 addition & 1 deletion klogr/klogr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"flag"
"testing"

"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/go-logr/logr"
)
Expand Down