Skip to content

Commit 79c5662

Browse files
authored
*: v1.7.0-rc3 (#4008)
As per the title... category: misc ticket: none
1 parent 459bc20 commit 79c5662

11 files changed

+39
-29
lines changed

app/log/config.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,20 +319,26 @@ func newStructuredLogger(format string, level zapcore.Level, color bool, ws zapc
319319
opt(&encConfig)
320320
}
321321

322-
var encoder zapcore.Encoder
322+
var (
323+
encoder zapcore.Encoder
324+
pretty bool
325+
)
323326

324327
switch format {
325328
case "logfmt":
326329
encoder = zaplogfmt.NewEncoder(encConfig)
330+
pretty = true
327331
case "json":
328332
encoder = zapcore.NewJSONEncoder(encConfig)
333+
pretty = false
329334
default:
330335
return nil, errors.New("invalid logger format; not console, logfmt or json", z.Str("format", format))
331336
}
332337

333338
structured := structuredEncoder{
334339
Encoder: encoder,
335340
consoleEncoder: newConsoleEncoder(false, color, false),
341+
pretty: pretty,
336342
}
337343

338344
return zap.New(
@@ -396,15 +402,19 @@ type structuredEncoder struct {
396402
zapcore.Encoder
397403

398404
consoleEncoder zapcore.Encoder
405+
406+
pretty bool
399407
}
400408

401409
func (e structuredEncoder) EncodeEntry(ent zapcore.Entry, fields []zap.Field) (*buffer.Buffer, error) {
402-
pretty, err := e.consoleEncoder.EncodeEntry(ent, append([]zap.Field(nil), fields...))
403-
if err != nil {
404-
return nil, err
405-
}
410+
if e.pretty {
411+
pretty, err := e.consoleEncoder.EncodeEntry(ent, append([]zap.Field(nil), fields...))
412+
if err != nil {
413+
return nil, err
414+
}
406415

407-
fields = append(fields, zap.String("pretty", pretty.String()))
416+
fields = append(fields, zap.String("pretty", pretty.String()))
417+
}
408418

409419
for i, f := range fields {
410420
if f.Key == keyStack {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
{"level":"info","ts":"00:00","caller":"log/log_test.go:83","msg":"see source","source":"source","pretty":"\u001b[34mINFO\u001b[0m \u001b[32m \u001b[0m see source {\"source\": \"source\"}\n"}
2-
{"level":"info","ts":"00:00","caller":"log/log_test.go:84","msg":"also source","source":"source","pretty":"\u001b[34mINFO\u001b[0m \u001b[32m \u001b[0m also source {\"source\": \"source\"}\n"}
1+
{"level":"info","ts":"00:00","caller":"log/log_test.go:83","msg":"see source","source":"source"}
2+
{"level":"info","ts":"00:00","caller":"log/log_test.go:84","msg":"also source","source":"source"}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
{"level":"error","ts":"00:00","caller":"log/log_test.go:66","msg":"err1: EOF","stacktrace":"\tapp/log/log_test.go:66 .func1\n\tapp/log/log_test.go:138 .func1","pretty":"\u001b[31mERRO\u001b[0m \u001b[32m \u001b[0m err1: EOF \n"}
2-
{"level":"error","ts":"00:00","caller":"log/log_test.go:67","msg":"err2: wrap: EOF","stacktrace":"\tapp/log/log_test.go:63 .func1\n\tapp/log/log_test.go:138 .func1","pretty":"\u001b[31mERRO\u001b[0m \u001b[32m \u001b[0m err2: wrap: EOF \n"}
1+
{"level":"error","ts":"00:00","caller":"log/log_test.go:66","msg":"err1: EOF","stacktrace":"\tapp/log/log_test.go:66 .func1\n\tapp/log/log_test.go:138 .func1"}
2+
{"level":"error","ts":"00:00","caller":"log/log_test.go:67","msg":"err2: wrap: EOF","stacktrace":"\tapp/log/log_test.go:63 .func1\n\tapp/log/log_test.go:138 .func1"}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
{"level":"warn","ts":"00:00","caller":"log/log_test.go:54","msg":"err1: first","stacktrace":"\tapp/log/log_test.go:49 .func1\n\tapp/log/log_test.go:138 .func1","1":1,"pretty":"\u001b[33mWARN\u001b[0m \u001b[32m \u001b[0m err1: first {\"1\": 1}\n"}
2-
{"level":"error","ts":"00:00","caller":"log/log_test.go:55","msg":"err2: second: first","stacktrace":"\tapp/log/log_test.go:49 .func1\n\tapp/log/log_test.go:138 .func1","2":2,"1":1,"pretty":"\u001b[31mERRO\u001b[0m \u001b[32m \u001b[0m err2: second: first {\"2\": 2, \"1\": 1}\n"}
3-
{"level":"error","ts":"00:00","caller":"log/log_test.go:56","msg":"err3: third: second: first","stacktrace":"\tapp/log/log_test.go:49 .func1\n\tapp/log/log_test.go:138 .func1","3":3,"2":2,"1":1,"pretty":"\u001b[31mERRO\u001b[0m \u001b[32m \u001b[0m err3: third: second: first {\"3\": 3, \"2\": 2, \"1\": 1}\n"}
1+
{"level":"warn","ts":"00:00","caller":"log/log_test.go:54","msg":"err1: first","stacktrace":"\tapp/log/log_test.go:49 .func1\n\tapp/log/log_test.go:138 .func1","1":1}
2+
{"level":"error","ts":"00:00","caller":"log/log_test.go:55","msg":"err2: second: first","stacktrace":"\tapp/log/log_test.go:49 .func1\n\tapp/log/log_test.go:138 .func1","2":2,"1":1}
3+
{"level":"error","ts":"00:00","caller":"log/log_test.go:56","msg":"err3: third: second: first","stacktrace":"\tapp/log/log_test.go:49 .func1\n\tapp/log/log_test.go:138 .func1","3":3,"2":2,"1":1}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"level":"info","ts":"00:00","caller":"log/log_test.go:93","msg":"expect","pretty":"\u001b[34mINFO\u001b[0m \u001b[32m \u001b[0m expect \n"}
1+
{"level":"info","ts":"00:00","caller":"log/log_test.go:93","msg":"expect"}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{"level":"info","ts":"00:00","caller":"log/log_test.go:104","msg":"expect1","pretty":"\u001b[34mINFO\u001b[0m \u001b[32m \u001b[0m expect1 \n"}
2-
{"level":"info","ts":"00:00","caller":"log/log_test.go:105","msg":"expect2","pretty":"\u001b[34mINFO\u001b[0m \u001b[32m \u001b[0m expect2 \n"}
3-
{"level":"info","ts":"00:00","caller":"log/log_test.go:106","msg":"expect3","pretty":"\u001b[34mINFO\u001b[0m \u001b[32m \u001b[0m expect3 \n"}
4-
{"level":"info","ts":"00:00","caller":"log/log_test.go:107","msg":"expect4","pretty":"\u001b[34mINFO\u001b[0m \u001b[32m \u001b[0m expect4 \n"}
1+
{"level":"info","ts":"00:00","caller":"log/log_test.go:104","msg":"expect1"}
2+
{"level":"info","ts":"00:00","caller":"log/log_test.go:105","msg":"expect2"}
3+
{"level":"info","ts":"00:00","caller":"log/log_test.go:106","msg":"expect3"}
4+
{"level":"info","ts":"00:00","caller":"log/log_test.go:107","msg":"expect4"}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"level":"error","ts":"00:00","caller":"log/log_test.go:117","msg":"test: wrap sentinel: test","stacktrace":"\tapp/log/log_test.go:117 .func1\n\tapp/log/log_test.go:138 .func1","pretty":"\u001b[31mERRO\u001b[0m \u001b[32m \u001b[0m test: wrap sentinel: test \n"}
1+
{"level":"error","ts":"00:00","caller":"log/log_test.go:117","msg":"test: wrap sentinel: test","stacktrace":"\tapp/log/log_test.go:117 .func1\n\tapp/log/log_test.go:138 .func1"}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{"level":"debug","ts":"00:00","caller":"log/log_test.go:40","msg":"msg1","ctx1":1,"pretty":"\u001b[35mDEBG\u001b[0m \u001b[32m \u001b[0m msg1 {\"ctx1\": 1}\n"}
2-
{"level":"info","ts":"00:00","caller":"log/log_test.go:41","msg":"msg2","ctx2":2,"wrap2":2,"pretty":"\u001b[34mINFO\u001b[0m \u001b[32m \u001b[0m msg2 {\"ctx2\": 2, \"wrap2\": 2}\n"}
3-
{"level":"warn","ts":"00:00","caller":"log/log_test.go:42","msg":"msg3a","wrap3":"a","wrap2":2,"pretty":"\u001b[33mWARN\u001b[0m \u001b[32m \u001b[0m msg3a {\"wrap3\": \"a\", \"wrap2\": 2}\n"}
4-
{"level":"warn","ts":"00:00","caller":"log/log_test.go:43","msg":"msg3b","wrap3":"b","wrap2":2,"pretty":"\u001b[33mWARN\u001b[0m \u001b[32m \u001b[0m msg3b {\"wrap3\": \"b\", \"wrap2\": 2}\n"}
1+
{"level":"debug","ts":"00:00","caller":"log/log_test.go:40","msg":"msg1","ctx1":1}
2+
{"level":"info","ts":"00:00","caller":"log/log_test.go:41","msg":"msg2","ctx2":2,"wrap2":2}
3+
{"level":"warn","ts":"00:00","caller":"log/log_test.go:42","msg":"msg3a","wrap3":"a","wrap2":2}
4+
{"level":"warn","ts":"00:00","caller":"log/log_test.go:43","msg":"msg3b","wrap3":"b","wrap2":2}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
{"level":"debug","ts":"00:00","caller":"log/log_test.go:28","msg":"msg1","ctx1":1,"topic":"topic","pretty":"\u001b[35mDEBG\u001b[0m \u001b[32mtopic \u001b[0m msg1 {\"ctx1\": 1}\n"}
2-
{"level":"info","ts":"00:00","caller":"log/log_test.go:29","msg":"msg2","ctx2":2,"topic":"topic","pretty":"\u001b[34mINFO\u001b[0m \u001b[32mtopic \u001b[0m msg2 {\"ctx2\": 2}\n"}
1+
{"level":"debug","ts":"00:00","caller":"log/log_test.go:28","msg":"msg1","ctx1":1,"topic":"topic"}
2+
{"level":"info","ts":"00:00","caller":"log/log_test.go:29","msg":"msg2","ctx2":2,"topic":"topic"}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ module github.com/obolnetwork/charon
33
go 1.25
44

55
require (
6-
github.com/attestantio/go-builder-client v0.7.1
7-
github.com/attestantio/go-eth2-client v0.27.0
6+
github.com/attestantio/go-builder-client v0.7.2
7+
github.com/attestantio/go-eth2-client v0.27.1
88
github.com/coinbase/kryptology v1.5.6-0.20220316191335-269410e1b06b
99
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0
1010
github.com/ethereum/go-ethereum v1.16.4

0 commit comments

Comments
 (0)