func (s *server) RegisterRouters(regFunc RouterFunc) {
	regFunc(s.r)
}
RegisterRouters register router functions for server
package server
import (
	"github.com/changsongl/delay-queue/pkg/log"
	"github.com/changsongl/delay-queue/vars"
	"github.com/gin-gonic/gin"
	"net/http"
	"os"
	"os/signal"
	"syscall"
)
type RouterFunc func(engine *gin.Engine)
type Server interface {
	Init()
	RegisterRouters(regFunc RouterFunc)
	Run(addr string) error
}
type server struct {
	r           *gin.Engine
	l           log.Logger
	beforeStart []Event
	afterStop   []Event
	env         vars.Env
}
type Event func()
func New(options ...Option) Server {
	s := &server{
		env: vars.EnvRelease,
	}
	for _, opt := range options {
		opt(s)
	}
	if s.env == vars.EnvRelease {
		gin.SetMode(gin.ReleaseMode)
	}
	r := gin.New()
	s.r = r
	return s
}
func (s *server) Init() {
	s.r.Use(gin.Recovery())
	if s.l != nil {
		s.r.Use(gin.LoggerWithConfig(gin.LoggerConfig{Output: s.l}))
	} else {
		s.r.Use(gin.LoggerWithConfig(gin.LoggerConfig{}))
	}
	WrapPProf(s.r)
	regMetricFunc := setServerMetricHandlerAndMiddleware()
	regMetricFunc(s.r)
}