1 Star 0 Fork 0

Wsage/go-framework

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
run_rpcserver.go 585 Bytes
一键复制 编辑 原始数据 按行查看 历史
王少奇 提交于 2021-09-01 11:30 . 新增 grpc的server
package main
import (
"fmt"
v1log "gitee.com/scottq/go-framework/src/v1/log"
v1rpc "gitee.com/scottq/go-framework/src/v1/rpcserver"
"google.golang.org/grpc"
"os"
"path/filepath"
)
func main() {
name := "example"
logPath := fmt.Sprintf("./runtime/logs/%s.log", filepath.Base(os.Args[0]))
logger := v1log.NewZapLog(name, logPath, nil)
httpServer, err := v1rpc.NewGRPCServer("", ":40001", func(server *grpc.Server) {
})
if err != nil {
logger.Error("run http server error:%s" + err.Error())
return
}
//添加logger
httpServer.AddLogger(logger)
httpServer.Run()
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/scottq/go-framework.git
git@gitee.com:scottq/go-framework.git
scottq
go-framework
go-framework
v1.1.11

搜索帮助