Skip to content

Commit 5df9106

Browse files
committed
remvoe category from FormatterArgs for #99
1 parent 8b90f55 commit 5df9106

File tree

8 files changed

+11
-13
lines changed

8 files changed

+11
-13
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ jobs:
4141
- uses: actions/checkout@v4
4242
- uses: actions/setup-go@v5
4343
with:
44-
go-version: '1.22'
44+
go-version: '1.24'
4545
- name: golangci-lint
4646
uses: golangci/golangci-lint-action@v7
4747
with:
48-
version: v1.60
48+
version: v2.0

async_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//nolint:errcheck
12
package log
23

34
import (

console_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestIsTerminal(t *testing.T) {
2323
// signal.Ignore(syscall.SIGSYS)
2424

2525
// Mute "function not implemented" and "undefined: syscall.SIGSYS" for non linux_amd64 platforms
26-
if !(runtime.GOOS == "linux" && runtime.GOARCH == "amd64") {
26+
if !(runtime.GOOS == "linux" && runtime.GOARCH == "amd64") { //nolint:errcheck
2727
return
2828
}
2929

formatter.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ type FormatterArgs struct {
1717
Goid string // "123"
1818
Stack string // "<stack string>"
1919
Message string // "a structure message"
20-
Category string // "cat1"
2120
KeyValues []struct {
2221
Key string // "foo"
2322
Value string // "bar"
@@ -53,8 +52,6 @@ func formatterArgsPos(key string) (pos int) {
5352
pos = 6
5453
case "message", "msg":
5554
pos = 7
56-
case "category":
57-
pos = 8
5855
}
5956
return
6057
}

formatter_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ func TestFormatterArgsParse(t *testing.T) {
3535
if args.Level != level {
3636
t.Fatalf("Failed to parse level: %s != %s", args.Level, level)
3737
}
38-
if args.Category != category {
39-
t.Fatalf("Failed to parse category: %s != %s", args.Category, category)
40-
}
4138
if args.Message != msg {
4239
t.Fatalf("Failed to parse messae: %s != %s", args.Message, msg)
4340
}

logger.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ type IOWriteCloser struct {
6767

6868
// WriteEntry implements Writer.
6969
func (w IOWriteCloser) WriteEntry(e *Entry) (n int, err error) {
70-
return w.WriteCloser.Write(e.buf)
70+
return w.WriteCloser.Write(e.buf) //nolint:staticcheck
7171
}
7272

7373
// Close implements Writer.
@@ -480,11 +480,12 @@ func (l *Logger) header(level Level) *Entry {
480480
}
481481
offset := timeOffset
482482
if l.TimeLocation != nil {
483-
if l.TimeLocation == time.UTC {
483+
switch l.TimeLocation {
484+
case time.UTC:
484485
offset = 0
485-
} else if l.TimeLocation == time.Local {
486+
case time.Local:
486487
offset = timeOffset
487-
} else {
488+
default:
488489
format := l.TimeFormat
489490
if format == "" {
490491
format = "2006-01-02T15:04:05.999Z07:00"

logger_std_log.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//nolint:staticcheck
12
package log
23

34
import (

logger_std_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//go:build go1.21
22

3+
//nolint:staticcheck
34
package log
45

56
import (

0 commit comments

Comments
 (0)