Skip to content

Commit

Permalink
Merge pull request #12212 from gyuho/logger
Browse files Browse the repository at this point in the history
*: upgrade zap logger to 1.15, replace global logger
  • Loading branch information
gyuho authored Aug 13, 2020
2 parents 93cf449 + d8ed233 commit 06f89cc
Show file tree
Hide file tree
Showing 20 changed files with 180 additions and 38 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG-3.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Note that any `etcd_debugging_*` metrics are experimental and subject to change.
- Remove [`embed.Config.Debug`](https://github.com/etcd-io/etcd/pull/10947).
- Use `embed.Config.LogLevel` instead.
- Add [`embed.Config.ZapLoggerBuilder`](https://github.com/etcd-io/etcd/pull/11147) to allow creating a custom zap logger.
- Replace [global `*zap.Logger` with etcd server logger object](https://github.com/etcd-io/etcd/pull/12212).

### Package `clientv3`

Expand Down Expand Up @@ -211,6 +212,7 @@ Note that any `etcd_debugging_*` metrics are experimental and subject to change.
### Dependency

- Upgrade [`google.golang.org/grpc`](https://github.com/grpc/grpc-go/releases) from [**`v1.23.0`**](https://github.com/grpc/grpc-go/releases/tag/v1.23.0) to [**`v1.26.0`**](https://github.com/grpc/grpc-go/releases/tag/v1.26.0).
- Upgrade [`go.uber.org/zap`](https://github.com/uber-go/zap/releases) from [**`v1.14.1`**](https://github.com/uber-go/zap/releases/tag/v1.14.1) to [**`v1.15.0`**](https://github.com/uber-go/zap/releases/tag/v1.15.0).

### Release

Expand Down
2 changes: 2 additions & 0 deletions embed/config_logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func (cfg *Config) setupLogging() error {
if err != nil {
return err
}
zap.ReplaceGlobals(c.logger)
c.loggerMu.Lock()
defer c.loggerMu.Unlock()
c.loggerConfig = &copied
Expand Down Expand Up @@ -145,6 +146,7 @@ func (cfg *Config) setupLogging() error {
if cfg.ZapLoggerBuilder == nil {
cfg.ZapLoggerBuilder = func(c *Config) error {
c.logger = zap.New(cr, zap.AddCaller(), zap.ErrorOutput(syncer))
zap.ReplaceGlobals(c.logger)
c.loggerMu.Lock()
defer c.loggerMu.Unlock()
c.loggerConfig = nil
Expand Down
3 changes: 2 additions & 1 deletion etcdserver/api/membership/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ package membership
import (
"encoding/json"
"fmt"
"github.com/coreos/go-semver/semver"
"path"
"reflect"
"testing"

"github.com/coreos/go-semver/semver"

"go.etcd.io/etcd/v3/etcdserver/api/v2store"
"go.etcd.io/etcd/v3/pkg/mock/mockstore"
"go.etcd.io/etcd/v3/pkg/testutil"
Expand Down
7 changes: 4 additions & 3 deletions etcdserver/api/membership/downgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ package membership
import (
"bytes"
"fmt"
"github.com/coreos/go-semver/semver"
"go.etcd.io/etcd/v3/version"
"go.uber.org/zap"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strconv"
"testing"

"github.com/coreos/go-semver/semver"
"go.etcd.io/etcd/v3/version"
"go.uber.org/zap"
)

func TestMustDetectDowngrade(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions etcdserver/api/snap/snapshotter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ package snap

import (
"fmt"
"go.etcd.io/etcd/v3/pkg/fileutil"
"hash/crc32"
"io/ioutil"
"os"
"path/filepath"
"reflect"
"testing"

"go.etcd.io/etcd/v3/pkg/fileutil"
"go.etcd.io/etcd/v3/raft/raftpb"
"go.etcd.io/etcd/v3/wal/walpb"

"go.uber.org/zap"
)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ require (
github.com/urfave/cli v1.20.0
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2
go.etcd.io/bbolt v1.3.5
go.uber.org/zap v1.14.1
go.uber.org/zap v1.15.0
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazu
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd/v22 v22.0.0 h1:XJIw/+VlJ+87J+doOxznsAWIdmWuViOVhkQamW5YV28=
github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
github.com/creack/pty v1.1.7 h1:6pwm8kMQKCmgUg0ZHTm5+/YvRK0s3THD/28+T6/kk4A=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw=
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -159,8 +157,8 @@ go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.14.1 h1:nYDKopTbvAPq/NrUVZwT15y2lpROBiLLyoRTbXOYWOo=
go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
go.uber.org/zap v1.15.0 h1:ZZCA22JRF2gQE5FoNmhmrf7jeJJ2uhqDUNRYKm8dvmM=
go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
Expand Down
2 changes: 1 addition & 1 deletion integration/embed/embed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ package embed_test
import (
"context"
"fmt"
"go.etcd.io/etcd/c/v3/pkg/transport"
"net/url"
"os"
"path/filepath"
Expand All @@ -32,6 +31,7 @@ import (

"go.etcd.io/etcd/v3/clientv3"
"go.etcd.io/etcd/v3/embed"
"go.etcd.io/etcd/v3/pkg/transport"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion integration/v3_barrier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"time"

"go.etcd.io/etcd/v3/clientv3"
"go.etcd.io/etcd/v3/contrib/recipes"
recipe "go.etcd.io/etcd/v3/contrib/recipes"
"go.etcd.io/etcd/v3/pkg/testutil"
)

Expand Down
2 changes: 1 addition & 1 deletion integration/v3_double_barrier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"time"

"go.etcd.io/etcd/v3/clientv3/concurrency"
"go.etcd.io/etcd/v3/contrib/recipes"
recipe "go.etcd.io/etcd/v3/contrib/recipes"
)

func TestDoubleBarrier(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion integration/v3_queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"sync/atomic"
"testing"

"go.etcd.io/etcd/v3/contrib/recipes"
recipe "go.etcd.io/etcd/v3/contrib/recipes"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion vendor/go.uber.org/zap/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions vendor/go.uber.org/zap/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 19 additions & 5 deletions vendor/go.uber.org/zap/config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions vendor/go.uber.org/zap/field.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions vendor/go.uber.org/zap/options.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion vendor/go.uber.org/zap/zapcore/field.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions vendor/go.uber.org/zap/zapcore/increase_level.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 06f89cc

Please sign in to comment.