support logger auto call

This commit is contained in:
yanghao05
2023-01-29 15:27:50 +08:00
parent 34b3978c5a
commit 7151c52543
13 changed files with 284 additions and 589 deletions

View File

@@ -14,18 +14,17 @@ import (
type Http struct {
dig.In
Logger *logger.Logger
Conf *config.Config
Service *http.Service
Routes []contracts.Route `group:"route"`
}
func Serve(http Http) error {
http.Logger.Infof("http service port %s", http.Conf.Http.Address())
logger.Infof("http service port %s", http.Conf.Http.Address())
for _, route := range http.Routes {
route.Register()
}
http.Logger.Infof("starting server on %s", http.Conf.Http.Address())
logger.Infof("starting server on %s", http.Conf.Http.Address())
return http.Service.Serve()
}