作者 yangfu

log/opp 打印日志

... ... @@ -12,7 +12,6 @@ import (
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/websocket"
"opp/internal/utils"
_ "opp/routers"
"opp/services/im"
"time"
)
... ... @@ -30,6 +29,7 @@ func init() {
//})
redisSource := fmt.Sprintf("%v:%v", beego.AppConfig.String("redis_add"), beego.AppConfig.String("redis_add_port"))
err := redis.InitWithDb(100, redisSource, beego.AppConfig.String("redis_auth"), "0")
log.Info(fmt.Sprintf("init redis:%v", redisSource))
if err != nil {
log.Fatal("connect to redis error address:", beego.AppConfig.String("redis_add_port"), beego.AppConfig.String("redis_auth"), err)
//panic(err)
... ... @@ -41,6 +41,7 @@ func init() {
beego.AppConfig.String("mysql_port"),
beego.AppConfig.String("mysql_db_name"),
)
log.Info(fmt.Sprintf("init mysql:%v", dataSource))
orm.NewBeeormEngine(config.Mysql{
//AliasName: "default",
DataSource: dataSource,
... ... @@ -55,7 +56,7 @@ func init() {
//Password:"ibfduqhfmgypbffe", //授权码
//IsUseSsl:true,
})
im.InitImClient(beego.AppConfig.String("net_im_base_url"), beego.AppConfig.String("net_im_app_key"), beego.AppConfig.String("net_im_app_secret"))
//im.InitImClient(beego.AppConfig.String("net_im_base_url"), beego.AppConfig.String("net_im_app_key"), beego.AppConfig.String("net_im_app_secret"))
websocket.InitWebsocketConnmgrs(10)
}
... ...
... ... @@ -3,8 +3,10 @@ package routers
import (
"github.com/astaxie/beego"
"github.com/prometheus/client_golang/prometheus/promhttp"
"net/http"
"opp/controllers"
"opp/controllers/v1"
"opp/services/websocket"
)
var nsV1 *beego.Namespace
... ... @@ -23,6 +25,7 @@ func init() {
)
beego.AddNamespace(nsV1)
beego.SetStaticPath("/file/opp", beego.AppConfig.String("source_path"))
beego.SetStaticPath("/log/opp", beego.AppConfig.String("aliyun_logs_access"))
beego.Handler("/metrics", promhttp.Handler())
//beego.Handler("/upgrage", http.HandlerFunc(websocket.Upgrage))
beego.Handler("/upgrage", http.HandlerFunc(websocket.Upgrage))
}
... ...