mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-08-24 16:05:07 +03:00
Added log of panic reason
This commit is contained in:
parent
399ad486f5
commit
4a7a8ff05a
1 changed files with 8 additions and 0 deletions
|
@ -129,6 +129,14 @@ func run(args yggArgs, ctx context.Context) {
|
|||
default:
|
||||
if logfd, err := os.OpenFile(args.logto, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644); err == nil {
|
||||
logger = log.New(logfd, "", log.Flags())
|
||||
defer func() int {
|
||||
if r := recover(); r != nil {
|
||||
logger.Println("Fatal error:", r)
|
||||
fmt.Print(logfd)
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}()
|
||||
}
|
||||
}
|
||||
if logger == nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue