Try to abstract the main part.

This commit is contained in:
zicla
2019-04-27 23:24:09 +08:00
parent 14b6a74666
commit 2732b14eae
14 changed files with 130 additions and 105 deletions

11
main.go
View File

@ -3,8 +3,9 @@ package main
import (
"fmt"
"github.com/eyebluecn/tank/code/config"
"github.com/eyebluecn/tank/code/logger"
"github.com/eyebluecn/tank/code/rest"
"github.com/eyebluecn/tank/code/support"
"github.com/eyebluecn/tank/code/tool/inter"
_ "github.com/go-sql-driver/mysql"
"log"
"net/http"
@ -13,8 +14,10 @@ import (
func main() {
//日志第一优先级保障
logger.LOGGER.Init()
defer logger.LOGGER.Destroy()
tankLogger := &support.TankLogger{}
tankLogger.Init()
defer tankLogger.Destroy()
inter.LOGGER = tankLogger
//装载配置文件,这个决定了是否需要执行安装过程
config.CONFIG.Init()
@ -25,7 +28,7 @@ func main() {
http.Handle("/", rest.CONTEXT.Router)
logger.LOGGER.Info("App started at http://localhost:%v", config.CONFIG.ServerPort)
inter.LOGGER.Info("App started at http://localhost:%v", config.CONFIG.ServerPort)
dotPort := fmt.Sprintf(":%v", config.CONFIG.ServerPort)
err1 := http.ListenAndServe(dotPort, nil)