Skip to content

Commit 9245af8

Browse files
committed
chore: fix test
1 parent 9b9cc28 commit 9245af8

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

.github/workflows/test.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@ jobs:
99
test:
1010
runs-on: ubuntu-latest
1111
steps:
12+
- uses: actions/checkout@v4
13+
- name: Install Go
14+
uses: actions/setup-go@v5
15+
with:
16+
go-version: v1.22.x
17+
- uses: actions/cache@v4
18+
with:
19+
path: |
20+
~/go/pkg/mod
21+
~/.cache/go-build
22+
.bin
23+
key: cache-${{ hashFiles('**/go.sum') }}-${{ hashFiles('.bin/*') }}
24+
restore-keys: |
25+
cache-
26+
1227
- name: Start LocalStack
1328
uses: LocalStack/[email protected]
1429
with:

pkg/consumer.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1313
"sigs.k8s.io/yaml"
1414

15+
"github.com/flanksource/commons/logger"
1516
"github.com/flanksource/duty/context"
1617
"github.com/flanksource/duty/shutdown"
1718
"github.com/flanksource/gomplate/v3"
@@ -42,7 +43,8 @@ func pretty(o any) string {
4243
}
4344
func RunConsumer(rootCtx context.Context, config Config) error {
4445
if config.LogLevel != "" {
45-
rootCtx.Logger.SetLogLevel(config.LogLevel)
46+
logger.StandardLogger().SetLogLevel(config.LogLevel)
47+
rootCtx.Infof("Set log level to %s => %v", config.LogLevel, rootCtx.Logger.GetLevel())
4648
}
4749

4850
if config.client == nil {
@@ -82,6 +84,7 @@ func RunConsumer(rootCtx context.Context, config Config) error {
8284
}
8385

8486
ctx := rootCtx.WithName(msg.LoggableID)
87+
ctx.Logger.SetLogLevel(config.LogLevel)
8588

8689
// Attempt to decode Bas64
8790
decoded, err := base64.StdEncoding.DecodeString(string(msg.Body))
@@ -99,7 +102,7 @@ func RunConsumer(rootCtx context.Context, config Config) error {
99102
data["_id"] = msg.LoggableID
100103
data["_metadata"] = msg.Metadata
101104

102-
ctx.Debugf("Received message: %+v", pretty(data))
105+
ctx.Debugf("Received message:\n %+v", pretty(data))
103106

104107
templater := gomplate.StructTemplater{
105108
Values: data,

0 commit comments

Comments
 (0)