mirror of
https://github.com/samuelncui/yatm.git
synced 2026-09-20 06:54:15 +00:00
feat: frontend use router
This commit is contained in:
+5
-1
@@ -9,6 +9,10 @@ import (
|
||||
)
|
||||
|
||||
func Wrap(ctx context.Context, f func()) {
|
||||
WrapWithLogger(ctx, logrus.StandardLogger(), f)
|
||||
}
|
||||
|
||||
func WrapWithLogger(ctx context.Context, logger *logrus.Logger, f func()) {
|
||||
defer func() {
|
||||
e := recover()
|
||||
if e == nil {
|
||||
@@ -23,7 +27,7 @@ func Wrap(ctx context.Context, f func()) {
|
||||
err = fmt.Errorf("%v", err)
|
||||
}
|
||||
|
||||
logrus.WithContext(ctx).WithError(err).Errorf("panic: %s", debug.Stack())
|
||||
logger.WithContext(ctx).WithError(err).Errorf("panic: %s", debug.Stack())
|
||||
}()
|
||||
|
||||
f()
|
||||
|
||||
Reference in New Issue
Block a user