mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 14:50:55 +00:00
Print error if occurred in WriteMsg
This commit is contained in:
parent
a3888cef7f
commit
1d1ad69954
10
logs/log.go
10
logs/log.go
@ -193,7 +193,10 @@ func (bl *BeeLogger) startLogger() {
|
|||||||
select {
|
select {
|
||||||
case bm := <-bl.msg:
|
case bm := <-bl.msg:
|
||||||
for _, l := range bl.outputs {
|
for _, l := range bl.outputs {
|
||||||
l.WriteMsg(bm.msg, bm.level)
|
err := l.WriteMsg(bm.msg, bm.level)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("ERROR, unable to WriteMsg:", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,7 +284,10 @@ func (bl *BeeLogger) Close() {
|
|||||||
if len(bl.msg) > 0 {
|
if len(bl.msg) > 0 {
|
||||||
bm := <-bl.msg
|
bm := <-bl.msg
|
||||||
for _, l := range bl.outputs {
|
for _, l := range bl.outputs {
|
||||||
l.WriteMsg(bm.msg, bm.level)
|
err := l.WriteMsg(bm.msg, bm.level)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("ERROR, unable to WriteMsg (while closing logger):", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user