main.go 542 B

123456789101112131415161718192021222324252627282930
  1. package main
  2. import (
  3. "fmt"
  4. "log"
  5. "server/initialize"
  6. "server/logger"
  7. "server/router"
  8. "server/utils"
  9. "server/work"
  10. )
  11. func main() {
  12. initRouter := router.InitRouter()
  13. logPath := "./logs/app.log"
  14. if err := logger.Initialize(logPath); err != nil {
  15. log.Fatalf("Failed to initialize logger: %v", err)
  16. }
  17. // 使用全局 Logger
  18. logger.Get().Info("Application started.")
  19. utils.LoadData1()
  20. work.MyJob()
  21. initialize.InitInductanceTCP()
  22. err := initRouter.Run(":8222")
  23. if err != nil {
  24. fmt.Println("服务器启动失败!")
  25. }
  26. }