Fix log format bug
This commit is contained in:
parent
62aa0188c4
commit
4855146ac6
@ -15,6 +15,8 @@ Beego is compos of four parts:
|
||||
3. Client: including ORM module, httplib module, cache module;
|
||||
4. Server: including web module. We will support gRPC in the future;
|
||||
|
||||
**Please use RELEASE version, or master branch which contains the latest bug fix**
|
||||
|
||||
## Quick Start
|
||||
|
||||
[Officail website](http://beego.me)
|
||||
|
||||
2
client/cache/ssdb/ssdb_test.go
vendored
2
client/cache/ssdb/ssdb_test.go
vendored
@ -60,7 +60,7 @@ func TestSsdbcacheCache(t *testing.T) {
|
||||
assert.Equal(t, 3, v)
|
||||
assert.Nil(t, err)
|
||||
|
||||
assert.NotNil(t, ssdb.Delete(context.Background(), "ssdb"))
|
||||
assert.Nil(t, ssdb.Delete(context.Background(), "ssdb"))
|
||||
assert.Nil(t, ssdb.Put(context.Background(), "ssdb", "ssdb", -10*time.Second))
|
||||
// test string
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ func (lm *LogMsg) OldStyleFormat() string {
|
||||
msg := lm.Msg
|
||||
|
||||
if len(lm.Args) > 0 {
|
||||
lm.Msg = fmt.Sprintf(lm.Msg, lm.Args...)
|
||||
msg = fmt.Sprintf(lm.Msg, lm.Args...)
|
||||
}
|
||||
|
||||
msg = lm.Prefix + " " + msg
|
||||
|
||||
@ -41,4 +41,8 @@ func TestLogMsg_OldStyleFormat(t *testing.T) {
|
||||
|
||||
res = lg.OldStyleFormat()
|
||||
assert.Equal(t, "[D] [/user/home/main.go:13] Cus Hello, world", res)
|
||||
|
||||
lg.Msg = "hello, %s"
|
||||
lg.Args = []interface{}{"world"}
|
||||
assert.Equal(t, "[D] [/user/home/main.go:13] Cus hello, world", lg.OldStyleFormat())
|
||||
}
|
||||
|
||||
@ -18,9 +18,10 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
)
|
||||
|
||||
func TestBeeLogger_DelLogger(t *testing.T) {
|
||||
func TestBeeLoggerDelLogger(t *testing.T) {
|
||||
prefix := "My-Cus"
|
||||
l := GetLogger(prefix)
|
||||
assert.NotNil(t, l)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user