Add when to write method
This commit is contained in:
@@ -261,6 +261,7 @@ func (bl *BeeLogger) Write(p []byte) (n int, err error) {
|
||||
lm := &LogMsg{
|
||||
Msg: string(p),
|
||||
Level: levelLoggerImpl,
|
||||
When: time.Now(),
|
||||
}
|
||||
|
||||
// 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.LineNumber = line
|
||||
lm.Prefix = bl.prefix
|
||||
|
||||
lm.enableFullFilePath = bl.enableFullFilePath
|
||||
lm.enableFuncCallDepth = bl.enableFuncCallDepth
|
||||
|
||||
@@ -25,4 +25,9 @@ func TestBeeLoggerDelLogger(t *testing.T) {
|
||||
prefix := "My-Cus"
|
||||
l := GetLogger(prefix)
|
||||
assert.NotNil(t, l)
|
||||
l.Print("hello")
|
||||
|
||||
GetLogger().Print("hello")
|
||||
SetPrefix("aaa")
|
||||
Info("hello")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user