
The highest tagged major version is
v2.
package
Version:
v1.7.1
Opens a new window with list of versions in this module.
Published: Feb 10, 2023
License: MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Manual
捕获运行时 panic
API
捕获 panic 并打印日志
func Recover(message string)
示例
package main
import (
"github.com/o8x/jk/crash"
"github.com/o8x/jk/signal"
)
func foo() {
panic("panic in foo")
}
func main() {
go func() {
defer crash.Recover("recover by main")
foo()
}()
signal.Wait()
}
运行它
> go run .
ERRO[0000] recover by main recover="panic in foo" stack="goroutine .. [running]:....."
Documentation
¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.