chore: move logger into internal

This commit is contained in:
0xJacky 2023-05-07 11:00:13 +08:00
parent 90af155e1b
commit 26524d20fb
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0
23 changed files with 56 additions and 58 deletions

52
main.go
View file

@ -1,40 +1,36 @@
package main
import (
"flag"
"fmt"
"github.com/0xJacky/Nginx-UI/logger"
"github.com/0xJacky/Nginx-UI/server"
"github.com/0xJacky/Nginx-UI/server/service"
"github.com/0xJacky/Nginx-UI/server/settings"
"github.com/gin-gonic/gin"
"github.com/jpillora/overseer"
"github.com/jpillora/overseer/fetcher"
"flag"
"fmt"
"github.com/0xJacky/Nginx-UI/server"
"github.com/0xJacky/Nginx-UI/server/service"
"github.com/0xJacky/Nginx-UI/server/settings"
"github.com/gin-gonic/gin"
"github.com/jpillora/overseer"
"github.com/jpillora/overseer/fetcher"
"log"
)
func main() {
var confPath string
flag.StringVar(&confPath, "config", "app.ini", "Specify the configuration file")
flag.Parse()
var confPath string
flag.StringVar(&confPath, "config", "app.ini", "Specify the configuration file")
flag.Parse()
settings.Init(confPath)
settings.Init(confPath)
logger.Init(settings.ServerSettings.RunMode)
gin.SetMode(settings.ServerSettings.RunMode)
gin.SetMode(settings.ServerSettings.RunMode)
r, err := service.GetRuntimeInfo()
defer logger.Sync()
if err != nil {
log.Fatalln(err)
}
r, err := service.GetRuntimeInfo()
if err != nil {
logger.Fatal(err)
}
overseer.Run(overseer.Config{
Program: server.Program,
Address: fmt.Sprintf(":%s", settings.ServerSettings.HttpPort),
Fetcher: &fetcher.File{Path: r.ExPath},
TerminateTimeout: 0,
})
overseer.Run(overseer.Config{
Program: server.Program,
Address: fmt.Sprintf(":%s", settings.ServerSettings.HttpPort),
Fetcher: &fetcher.File{Path: r.ExPath},
TerminateTimeout: 0,
})
}