This commit is contained in:
crusader 2018-03-21 20:17:31 +09:00
parent bde58378b4
commit 8f3e430ac8
5 changed files with 7 additions and 32 deletions

View File

@ -1,8 +1,6 @@
package grpc
import (
"fmt"
cgp "git.loafle.net/commons_go/grpc_pool"
"git.loafle.net/commons_go/logging"
ooas "git.loafle.net/overflow/overflow_api_server/golang"
@ -22,7 +20,7 @@ func ExternalInit() {
grpcPool = cgp.New(ph)
if err := grpcPool.Start(); nil != err {
logging.Logger().Panic(fmt.Sprintf("App: %v", err))
logging.Logger().Panicf("App: %v", err)
return
}
}

View File

@ -1,8 +1,6 @@
package redis
import (
"fmt"
"git.loafle.net/overflow/overflow_gateway_websocket/config"
"git.loafle.net/commons_go/logging"
@ -22,7 +20,7 @@ func ExternalInit() {
RedisPool = crp.New(ph)
if err := RedisPool.Start(); nil != err {
logging.Logger().Panic(fmt.Sprintf("App: %v", err))
logging.Logger().Panicf("App: %v", err)
return
}
}

View File

@ -1,19 +1 @@
package overflow_gateway_websocket
import (
"flag"
cc "git.loafle.net/commons_go/config"
"git.loafle.net/overflow/overflow_gateway_websocket/config"
)
func init() {
configPath := flag.String(ConfigPathFlagName, "./", "The path of config file")
flag.Parse()
cc.SetConfigPath(*configPath)
if err := cc.Load(&config.Config, ConfigFileName); nil != err {
panic(err)
}
}

View File

@ -1,7 +1,6 @@
package server
import (
"fmt"
"net"
"time"
@ -20,7 +19,7 @@ import (
func NewServerHandler() ServerHandler {
if nil == config.Config.Server {
logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: Config of server is not initialized"))
logging.Logger().Panicf("Gateway Websocket: Config of server is not initialized")
}
sh := &ServerHandlers{}
@ -71,7 +70,7 @@ func (sh *ServerHandlers) OnStart(serverCTX cwf.ServerContext) {
sh.redisSubscriber = oosr.New(redis.RedisPool.Get())
if err := sh.redisSubscriber.Start(); nil != err {
logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: Redist Subscriber did not start %v", err))
logging.Logger().Panicf("Gateway Websocket: Redist Subscriber did not start %v", err)
return
}
@ -95,7 +94,7 @@ func (sh *ServerHandlers) OnStop(serverCTX cwf.ServerContext) {
func (sh *ServerHandlers) RegisterServlet(servletName string, servletHandler servlet.ServletHandler) {
cfg := config.Config.Servlets[servletName]
if nil == cfg {
logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: config of servlet[%s] is not exist", servletName))
logging.Logger().Panicf("Gateway Websocket: config of servlet[%s] is not exist", servletName)
return
}
@ -116,7 +115,7 @@ func (sh *ServerHandlers) RegisterServlet(servletName string, servletHandler ser
func (sh *ServerHandlers) RegisterRPCGatewayServlet(servletName string, gatewayRPCHandler rpc.GatewayRPCHandler) servlet.ServletHandler {
cfg := config.Config.Servlets[servletName]
if nil == cfg {
logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: config of servlet[%s] is not exist", servletName))
logging.Logger().Panicf("Gateway Websocket: config of servlet[%s] is not exist", servletName)
return nil
}

View File

@ -1,8 +1,6 @@
package subscribe
import (
"fmt"
"git.loafle.net/commons_go/logging"
cwf "git.loafle.net/commons_go/websocket_fasthttp"
"git.loafle.net/overflow/overflow_gateway_websocket/servlet"
@ -27,6 +25,6 @@ func (sh *SubscriberHandlers) Validate() {
sh.SubscriberHandlers.Validate()
if nil == sh.ServletHandler {
logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: servletHandler must be specified"))
logging.Logger().Panicf("Gateway Websocket: servletHandler must be specified")
}
}