本文整理汇总了Golang中github.com/TF2Stadium/Helen/helpers.InitLogger函数的典型用法代码示例。如果您正苦于以下问题:Golang InitLogger函数的具体用法?Golang InitLogger怎么用?Golang InitLogger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InitLogger函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
helpers.InitLogger()
config.SetupConstants()
if config.Constants.ProfilerEnable {
address := "localhost:" + config.Constants.ProfilerPort
go func() {
graceful.Run(address, 1*time.Second, nil)
}()
helpers.Logger.Debug("Running Profiler at %s", address)
}
pid := &pid.Instance{}
if pid.Create() == nil {
defer pid.Remove()
}
authority.RegisterTypes()
helpers.InitAuthorization()
database.Init()
migrations.Do()
stores.SetupStores()
models.PaulingConnect()
models.FumbleConnect()
models.InitializeLobbySettings("./lobbySettingsData.json")
StartPaulingListener()
chelpers.InitDB()
if config.Constants.SteamIDWhitelist != "" {
go chelpers.WhitelistListener()
}
// lobby := models.NewLobby("cp_badlands", 10, "a", "a", 1)
helpers.Logger.Debug("Starting the server")
// init http server
// init socket.io server
server := wsevent.NewServer()
nologin := wsevent.NewServer()
broadcaster.Init(server, nologin)
socket.ServerInit(server, nologin)
routes.SetupHTTPRoutes(server, nologin)
if val := os.Getenv("DEPLOYMENT_ENV"); strings.ToLower(val) != "production" {
// init static FileServer
// TODO be careful to set this to correct location when deploying
http.HandleFunc("/static/", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, r.URL.Path[1:])
})
}
corsHandler := cors.New(cors.Options{
AllowedOrigins: config.Constants.AllowedCorsOrigins,
AllowCredentials: true,
}).Handler(http.DefaultServeMux)
// start the server
helpers.Logger.Debug("Serving at %s", config.Constants.Domain)
graceful.Run(":"+config.Constants.Port, 1*time.Second, corsHandler)
}
开发者ID:demipixel,项目名称:Helen,代码行数:60,代码来源:main.go
示例2: main
func main() {
authority.RegisterTypes()
helpers.InitLogger()
helpers.InitAuthorization()
config.SetupConstants()
database.Init()
migrations.Do()
stores.SetupStores()
models.PaulingConnect()
go models.ReadyTimeoutListener()
StartListener()
chelpers.CheckLogger()
if config.Constants.SteamIDWhitelist != "" {
chelpers.InitSteamIDWhitelist(config.Constants.SteamIDWhitelist)
}
// lobby := models.NewLobby("cp_badlands", 10, "a", "a", 1)
helpers.Logger.Debug("Starting the server")
// init http server
routes.SetupHTTPRoutes()
// init socket.io server
socketServer, err := socketio.NewServer(nil)
if err != nil {
helpers.Logger.Fatal(err.Error())
}
broadcaster.Init(socketServer)
defer broadcaster.Stop()
routes.SetupSocketRoutes(socketServer)
http.Handle("/socket.io/", socketServer)
// init static FileServer
// TODO be careful to set this to correct location when deploying
http.HandleFunc("/static/", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, r.URL.Path[1:])
})
corsHandler := cors.New(cors.Options{
AllowedOrigins: config.Constants.AllowedCorsOrigins,
AllowCredentials: true,
}).Handler(http.DefaultServeMux)
// start the server
helpers.Logger.Debug("Serving at localhost:" + config.Constants.Port + "...")
graceful.Run(":"+config.Constants.Port, 10*time.Second, corsHandler)
}
开发者ID:N1xx1,项目名称:Helen,代码行数:45,代码来源:main.go
示例3: main
func main() {
helpers.InitLogger()
config.SetupConstants()
database.Init()
migrations.Do()
stores.SetupStores()
models.InitServerConfigs()
// lobby := models.NewLobby("cp_badlands", 10, "a", "a", 1)
helpers.Logger.Debug("Starting the server")
r := mux.NewRouter()
// init http server
routes.SetupHTTPRoutes(r)
http.Handle("/", r)
// init socket.io server
socketServer, err := socketio.NewServer(nil)
if err != nil {
helpers.Logger.Fatal(err.Error())
}
socket.InitBroadcaster(socketServer)
routes.SetupSocketRoutes(socketServer)
r.Handle("/socket.io/", socketServer)
// init static FileServer
// TODO be careful to set this to correct location when deploying
r.PathPrefix("/static/").Handler(http.StripPrefix("/static/",
http.FileServer(http.Dir(config.Constants.StaticFileLocation))))
corsHandler := cors.New(cors.Options{
AllowedOrigins: config.Constants.AllowedCorsOrigins,
AllowCredentials: true,
}).Handler(r)
// start the server
helpers.Logger.Debug("Serving at localhost:" + config.Constants.Port + "...")
graceful.Run(":"+config.Constants.Port, 10*time.Second, corsHandler)
}
开发者ID:UnnoTed,项目名称:Helen,代码行数:40,代码来源:main.go
示例4: init
func init() {
helpers.InitLogger()
}
开发者ID:gpittarelli,项目名称:Helen,代码行数:3,代码来源:constants_test.go
示例5: init
func init() {
helpers.InitLogger()
testhelpers.CleanupDB()
}
开发者ID:gpittarelli,项目名称:Helen,代码行数:4,代码来源:admin_log_test.go
示例6: main
func main() {
helpers.InitLogger()
flag.Parse()
if *flagGen {
key := securecookie.GenerateRandomKey(64)
if len(key) == 0 {
logrus.Fatal("Couldn't generate random key")
}
base64Key := base64.StdEncoding.EncodeToString(key)
fmt.Println(base64Key)
return
}
config.SetupConstants()
go rpc.StartRPC()
if config.Constants.ProfilerEnable {
address := "localhost:" + config.Constants.ProfilerPort
go func() {
graceful.Run(address, 1*time.Second, nil)
}()
logrus.Info("Running Profiler at %s", address)
}
pid := &pid.Instance{}
if pid.Create() == nil {
defer pid.Remove()
}
authority.RegisterTypes()
helpers.InitAuthorization()
database.Init()
migrations.Do()
stores.SetupStores()
models.InitializeLobbySettings("./lobbySettingsData.json")
models.ConnectRPC()
models.DeleteUnusedServerRecords()
go models.Ping()
chelpers.InitGeoIPDB()
if config.Constants.SteamIDWhitelist != "" {
go chelpers.WhitelistListener()
}
// lobby := models.NewLobby("cp_badlands", 10, "a", "a", 1)
mux := http.NewServeMux()
routes.SetupHTTP(mux)
socket.RegisterHandlers()
if val := os.Getenv("DEPLOYMENT_ENV"); strings.ToLower(val) != "production" {
// init static FileServer
// TODO be careful to set this to correct location when deploying
mux.HandleFunc("/static/", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, r.URL.Path[1:])
})
}
corsHandler := cors.New(cors.Options{
AllowedOrigins: config.AllowedCorsOrigins,
AllowCredentials: true,
}).Handler(context.ClearHandler(mux))
// start the server
logrus.Info("Serving on", config.HTTPAddress())
graceful.Run(config.Constants.Address, 1*time.Second, corsHandler)
}
开发者ID:gpittarelli,项目名称:Helen,代码行数:68,代码来源:main.go
注:本文中的github.com/TF2Stadium/Helen/helpers.InitLogger函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论