Skip to content

Commit 6e0c995

Browse files
authored
feat(log): Updated default logger and added possibility to dump logs test buffer (#92)
1 parent 3db5ece commit 6e0c995

37 files changed

+2943
-1
lines changed

.github/workflows/coverage.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
- "fxconfig"
3636
- "fxcron"
3737
- "fxgenerate"
38+
- "fxgrpcserver"
3839
- "fxhealthcheck"
3940
- "fxhttpclient"
4041
- "fxhttpserver"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "fxgrpcserver-ci"
2+
3+
on:
4+
push:
5+
branches:
6+
- "feat**"
7+
- "fix**"
8+
- "hotfix**"
9+
- "chore**"
10+
paths:
11+
- "fxgrpcserver/**.go"
12+
- "fxgrpcserver/go.mod"
13+
- "fxgrpcserver/go.sum"
14+
pull_request:
15+
types:
16+
- opened
17+
- synchronize
18+
- reopened
19+
branches:
20+
- main
21+
paths:
22+
- "fxgrpcserver/**.go"
23+
- "fxgrpcserver/go.mod"
24+
- "fxgrpcserver/go.sum"
25+
26+
jobs:
27+
ci:
28+
uses: ./.github/workflows/common-ci.yml
29+
secrets: inherit
30+
with:
31+
module: "fxgrpcserver"

docs/modules/fxlog.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ You can use the provided [test assertion helpers](https://github.com/ankorstore/
7070
- `AssertContainLogRecord`: to assert on partial attributes match
7171
- `AssertContainNotLogRecord`: to assert on partial attributes non match
7272

73+
and use `Dump()` to print the current content of the [TestLogBuffer](https://github.com/ankorstore/yokai/blob/main/log/logtest/buffer.go).
74+
7375
For example:
7476

7577
```go title="internal/example_test.go"
@@ -94,7 +96,10 @@ func TestExample(t *testing.T) {
9496
logger.Debug().Msg("test message")
9597
}),
9698
)
97-
99+
100+
// print logs records
101+
logBuffer.Dump()
102+
98103
// log assertion example
99104
logtest.AssertHasLogRecord(
100105
t,

fxgrpcserver/.golangci.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
run:
2+
timeout: 5m
3+
concurrency: 8
4+
5+
linters:
6+
enable:
7+
- asasalint
8+
- asciicheck
9+
- bidichk
10+
- bodyclose
11+
- containedctx
12+
- contextcheck
13+
- cyclop
14+
- decorder
15+
- dogsled
16+
- durationcheck
17+
- errcheck
18+
- errchkjson
19+
- errname
20+
- errorlint
21+
- exhaustive
22+
- forbidigo
23+
- forcetypeassert
24+
- gocognit
25+
- goconst
26+
- gocritic
27+
- gocyclo
28+
- godot
29+
- godox
30+
- gofmt
31+
- goheader
32+
- gomoddirectives
33+
- gomodguard
34+
- goprintffuncname
35+
- gosec
36+
- gosimple
37+
- govet
38+
- grouper
39+
- importas
40+
- ineffassign
41+
- interfacebloat
42+
- logrlint
43+
- maintidx
44+
- makezero
45+
- misspell
46+
- nilerr
47+
- nilnil
48+
- nlreturn
49+
- nolintlint
50+
- nosprintfhostport
51+
- predeclared
52+
- promlinter
53+
- reassign
54+
- staticcheck
55+
- tenv
56+
- thelper
57+
- tparallel
58+
- typecheck
59+
- unconvert
60+
- unparam
61+
- unused
62+
- usestdlibvars
63+
- whitespace

0 commit comments

Comments
 (0)