添加世界运行异常时的堆栈打印
This commit is contained in:
parent
37e06d2aaf
commit
0eb750b76a
3
world.go
3
world.go
@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"math"
|
"math"
|
||||||
|
"runtime/debug"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/yohamta/donburi"
|
"github.com/yohamta/donburi"
|
||||||
@ -219,6 +220,8 @@ func (w *world) run() {
|
|||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
w.exception(err)
|
w.exception(err)
|
||||||
|
slog.Error("世界运行异常", "error", err, "stack", string(debug.Stack()))
|
||||||
|
debug.PrintStack()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
for range w.ticker.C {
|
for range w.ticker.C {
|
||||||
|
Loading…
Reference in New Issue
Block a user