blob: 965252416eefab3ce3de666a1a7afcae2877005e [file] [log] [blame]
Serge Bazanski98e05e12023-04-05 12:44:14 +02001Implement LoggerBuilder override in etcd integration library. That library is
2generally not designed to be consumed by outside code, and we should migrate
3off of it instead. But that's a future Monogon problem.
4
5diff -ur io_etcd_go_etcd_tests_v3.orig/integration/cluster.go io_etcd_go_etcd_tests_v3/integration/cluster.go
6--- io_etcd_go_etcd_tests_v3.orig/integration/cluster.go 2023-04-05 10:18:09.220532258 +0200
7+++ io_etcd_go_etcd_tests_v3/integration/cluster.go 2023-04-05 10:26:36.870901710 +0200
8@@ -171,6 +170,7 @@
9
10 WatchProgressNotifyInterval time.Duration
11 CorruptCheckTime time.Duration
12+ LoggerBuilder func(memberName string) *zap.Logger
13 }
14
15 type cluster struct {
16@@ -334,6 +335,7 @@
17 leaseCheckpointInterval: c.cfg.LeaseCheckpointInterval,
18 WatchProgressNotifyInterval: c.cfg.WatchProgressNotifyInterval,
19 CorruptCheckTime: c.cfg.CorruptCheckTime,
20+ LoggerBuilder: c.cfg.LoggerBuilder,
21 })
22 m.DiscoveryURL = c.cfg.DiscoveryURL
23 if c.cfg.UseGRPC {
24@@ -638,6 +640,7 @@
25 leaseCheckpointPersist bool
26 WatchProgressNotifyInterval time.Duration
27 CorruptCheckTime time.Duration
28+ LoggerBuilder func(memberName string) *zap.Logger
29 }
30
31 // mustNewMember return an inited member with the given name. If peerTLS is
32@@ -747,7 +750,11 @@
33
34 m.V2Deprecation = config.V2_DEPR_DEFAULT
35 m.grpcServerRecorder = &grpc_testing.GrpcRecorder{}
36- m.Logger = memberLogger(t, mcfg.name)
37+ if mcfg.LoggerBuilder != nil {
38+ m.Logger = mcfg.LoggerBuilder(mcfg.name)
39+ } else {
40+ m.Logger = memberLogger(t, mcfg.name)
41+ }
42 t.Cleanup(func() {
43 // if we didn't cleanup the logger, the consecutive test
44 // might reuse this (t).