Skip to content

Commit f457323

Browse files
authored
Merge pull request #12 from liuxp0827/f_newlogger_hook
支持日志按日志等级分割文件
2 parents ff11e49 + f84bee1 commit f457323

37 files changed

+162
-69
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## v0.1.20(2020-08-21)
2+
3+
### New Features
4+
- 日志文件可根据不同日志等级进行切分,不同级别日志记录到对应的日志文件
5+
16
## v0.1.19(2020-06-16)
27

38
### New Features

alimns/alimns_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package alimns
22

33
import (
4-
"testing"
54
"github.com/qit-team/snow-core/config"
5+
"testing"
66
)
77

88
func TestNewMnsClient(t *testing.T) {

alimns/provider.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package alimns
22

33
import (
4-
"github.com/qit-team/snow-core/config"
5-
"github.com/qit-team/snow-core/kernel/container"
6-
"github.com/aliyun/aliyun-mns-go-sdk"
4+
"errors"
75
"fmt"
6+
"github.com/aliyun/aliyun-mns-go-sdk"
7+
"github.com/qit-team/snow-core/config"
88
"github.com/qit-team/snow-core/helper"
9+
"github.com/qit-team/snow-core/kernel/container"
910
"sync"
10-
"errors"
1111
)
1212

1313
const (

alimns/provider_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package alimns
22

33
import (
4-
"testing"
54
"github.com/qit-team/snow-core/config"
5+
"testing"
66
)
77

88
func Test_getSingleton(t *testing.T) {
@@ -33,7 +33,7 @@ func TestProvider(t *testing.T) {
3333
}
3434

3535
arr = Pr.Provides()
36-
if !(len(arr) == 2 && arr[1] == "mns1"|| arr[1] == "mns") {
36+
if !(len(arr) == 2 && arr[1] == "mns1" || arr[1] == "mns") {
3737
t.Errorf("Provides is not match. %v", arr)
3838
return
3939
}

cache/memorycache/memory_cache.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ package memorycache
22

33
import (
44
"context"
5+
"errors"
6+
"fmt"
57
"github.com/qit-team/snow-core/cache"
8+
"strconv"
69
"sync"
710
"time"
8-
"errors"
9-
"strconv"
10-
"fmt"
1111
)
1212

1313
const (

cache/memorycache/memory_cache_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ package memorycache
22

33
import (
44
"context"
5+
"errors"
56
"github.com/qit-team/snow-core/cache"
67
"testing"
78
"time"
8-
"errors"
99
)
1010

1111
var c cache.Cache
@@ -208,7 +208,6 @@ func TestMemoryCache_IncrBy(t *testing.T) {
208208
}
209209
}
210210

211-
212211
func TestMemoryCache_DecrBy(t *testing.T) {
213212
ctx := context.TODO()
214213
key := "test-desc"
@@ -231,7 +230,7 @@ func TestMemoryCache_DecrBy(t *testing.T) {
231230
return
232231
}
233232

234-
c.Delete(ctx , key)
233+
c.Delete(ctx, key)
235234
res, err = c.DecrBy(ctx, key, -30)
236235
if err != nil {
237236
t.Error(err)
@@ -241,6 +240,3 @@ func TestMemoryCache_DecrBy(t *testing.T) {
241240
return
242241
}
243242
}
244-
245-
246-

command/command.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package command
22

33
import (
4-
"sync"
54
"errors"
5+
"sync"
66
)
77

88
var (

command/command_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package command
22

33
import (
4-
"testing"
54
"fmt"
5+
"testing"
66
)
77

88
func TestNew(t *testing.T) {

config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ type MnsConfig struct {
5757
type LogConfig struct {
5858
Handler string
5959
Level string
60+
Segment bool
6061
Dir string
6162
FileName string
6263
}

db/db.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import (
77
//_ "github.com/denisenkom/go-mssqldb" //mssql
88
"errors"
99
"fmt"
10-
"xorm.io/xorm"
1110
"github.com/qit-team/snow-core/config"
1211
"time"
1312
"xorm.io/core"
13+
"xorm.io/xorm"
1414
)
1515

1616
const (

0 commit comments

Comments
 (0)