commit
f2b98d5ed4
@ -1,4 +1,5 @@
|
|||||||
# developing
|
# developing
|
||||||
|
- Fix 4503 and 4504: Add `when` to `Write([]byte)` method and add `prefix` to `writeMsg`. [4507](https://github.com/beego/beego/pull/4507)
|
||||||
- Fix 4480: log format incorrect. [4482](https://github.com/beego/beego/pull/4482)
|
- Fix 4480: log format incorrect. [4482](https://github.com/beego/beego/pull/4482)
|
||||||
- Remove `duration` from prometheus labels. [4391](https://github.com/beego/beego/pull/4391)
|
- Remove `duration` from prometheus labels. [4391](https://github.com/beego/beego/pull/4391)
|
||||||
- Fix `unknown escape sequence` in generated code. [4385](https://github.com/beego/beego/pull/4385)
|
- Fix `unknown escape sequence` in generated code. [4385](https://github.com/beego/beego/pull/4385)
|
||||||
|
|||||||
@ -261,6 +261,7 @@ func (bl *BeeLogger) Write(p []byte) (n int, err error) {
|
|||||||
lm := &LogMsg{
|
lm := &LogMsg{
|
||||||
Msg: string(p),
|
Msg: string(p),
|
||||||
Level: levelLoggerImpl,
|
Level: levelLoggerImpl,
|
||||||
|
When: time.Now(),
|
||||||
}
|
}
|
||||||
|
|
||||||
// set levelLoggerImpl to ensure all log message will be write out
|
// set levelLoggerImpl to ensure all log message will be write out
|
||||||
@ -291,6 +292,7 @@ func (bl *BeeLogger) writeMsg(lm *LogMsg) error {
|
|||||||
}
|
}
|
||||||
lm.FilePath = file
|
lm.FilePath = file
|
||||||
lm.LineNumber = line
|
lm.LineNumber = line
|
||||||
|
lm.Prefix = bl.prefix
|
||||||
|
|
||||||
lm.enableFullFilePath = bl.enableFullFilePath
|
lm.enableFullFilePath = bl.enableFullFilePath
|
||||||
lm.enableFuncCallDepth = bl.enableFuncCallDepth
|
lm.enableFuncCallDepth = bl.enableFuncCallDepth
|
||||||
|
|||||||
@ -25,4 +25,9 @@ func TestBeeLoggerDelLogger(t *testing.T) {
|
|||||||
prefix := "My-Cus"
|
prefix := "My-Cus"
|
||||||
l := GetLogger(prefix)
|
l := GetLogger(prefix)
|
||||||
assert.NotNil(t, l)
|
assert.NotNil(t, l)
|
||||||
|
l.Print("hello")
|
||||||
|
|
||||||
|
GetLogger().Print("hello")
|
||||||
|
SetPrefix("aaa")
|
||||||
|
Info("hello")
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user