feat: frontend use router

This commit is contained in:
Samuel N Cui
2022-12-13 20:02:29 +08:00
parent b9355ad892
commit cda9244e8e
10 changed files with 167 additions and 62 deletions
+5 -1
View File
@@ -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()