refactor: use zap as logger

This commit is contained in:
0xJacky 2023-05-06 21:09:22 +08:00
parent 2831208de3
commit f305701b30
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0
34 changed files with 327 additions and 175 deletions

51
main.go
View file

@ -1,36 +1,39 @@
package main
import (
"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"
"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"
"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)
gin.SetMode(settings.ServerSettings.RunMode)
gin.SetMode(settings.ServerSettings.RunMode)
r, err := service.GetRuntimeInfo()
r, err := service.GetRuntimeInfo()
if err != nil {
log.Fatalln(err)
}
defer logger.Sync()
overseer.Run(overseer.Config{
Program: server.Program,
Address: fmt.Sprintf(":%s", settings.ServerSettings.HttpPort),
Fetcher: &fetcher.File{Path: r.ExPath},
TerminateTimeout: 0,
})
if err != nil {
log.Fatalln(err)
}
overseer.Run(overseer.Config{
Program: server.Program,
Address: fmt.Sprintf(":%s", settings.ServerSettings.HttpPort),
Fetcher: &fetcher.File{Path: r.ExPath},
TerminateTimeout: 0,
})
}