diff --git a/external/grpc/pool.go b/external/grpc/pool.go index 4c98317..dd335e9 100644 --- a/external/grpc/pool.go +++ b/external/grpc/pool.go @@ -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 } } diff --git a/external/redis/pool.go b/external/redis/pool.go index b381fa1..cb8e45f 100644 --- a/external/redis/pool.go +++ b/external/redis/pool.go @@ -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 } } diff --git a/gateway_websocket.go b/gateway_websocket.go index c666d70..20b7166 100644 --- a/gateway_websocket.go +++ b/gateway_websocket.go @@ -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) - } -} diff --git a/server/server_handlers.go b/server/server_handlers.go index 5e0b6b9..dd23196 100644 --- a/server/server_handlers.go +++ b/server/server_handlers.go @@ -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 } diff --git a/subscribe/subscriber_handlers.go b/subscribe/subscriber_handlers.go index ced26e1..83a7b11 100644 --- a/subscribe/subscriber_handlers.go +++ b/subscribe/subscriber_handlers.go @@ -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") } }