mirror of
https://github.com/astaxie/beego.git
synced 2024-11-29 12:11:28 +00:00
Merge pull request #779 from francoishill/patch-17
Print error if occurred in WriteMsg
This commit is contained in:
commit
e51a9d6481
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