Skip to content

Commit 95fc40f

Browse files
lvan100lianghuan
authored andcommitted
refactor(gs): supports multiple log file formats
1 parent 2042b7f commit 95fc40f

File tree

3 files changed

+2
-14
lines changed

3 files changed

+2
-14
lines changed

conf/expr_test.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,6 @@ func TestExpr(t *testing.T) {
4040
assert.That(t, 4).Equal(v.A)
4141
})
4242

43-
t.Run("multiple expressions", func(t *testing.T) {
44-
var v struct {
45-
A int `value:"${a}" expr:"checkInt($)" expr:"$ > 0"`
46-
}
47-
p := conf.Map(map[string]any{
48-
"a": 3,
49-
})
50-
err := p.Bind(&v)
51-
assert.That(t, err).Nil()
52-
assert.That(t, 3).Equal(v.A)
53-
})
54-
5543
t.Run("constant expression", func(t *testing.T) {
5644
var v struct {
5745
A int `value:"${a}" expr:"$ < 10"`

gs/app.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ func (s *AppStarter) Run(fn ...func() error) {
9696

9797
// Wait until shutdown completes
9898
s.stopApp()
99-
return
10099
}
101100

102101
// RunAsync starts the application asynchronously and returns a function

gs/log.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package gs
1818

1919
import (
20+
"context"
2021
"path/filepath"
2122
"strings"
2223

@@ -79,7 +80,7 @@ func initLog() error {
7980
// Step 5: Apply logging configuration or fall back to defaults.
8081
switch n := len(logFiles); {
8182
case n == 0:
82-
log.Infof(nil, log.TagAppDef, "no log configuration file found, using default logger")
83+
log.Infof(context.Background(), log.TagAppDef, "no log configuration file found, using default logger")
8384
return nil
8485
case n > 1:
8586
return util.FormatError(nil, "multiple log files found: %s", logFiles)

0 commit comments

Comments
 (0)