作者 yangfu

log/opp 打印日志

@@ -12,7 +12,6 @@ import ( @@ -12,7 +12,6 @@ import (
12 "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/websocket" 12 "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/websocket"
13 "opp/internal/utils" 13 "opp/internal/utils"
14 _ "opp/routers" 14 _ "opp/routers"
15 - "opp/services/im"  
16 "time" 15 "time"
17 ) 16 )
18 17
@@ -30,6 +29,7 @@ func init() { @@ -30,6 +29,7 @@ func init() {
30 //}) 29 //})
31 redisSource := fmt.Sprintf("%v:%v", beego.AppConfig.String("redis_add"), beego.AppConfig.String("redis_add_port")) 30 redisSource := fmt.Sprintf("%v:%v", beego.AppConfig.String("redis_add"), beego.AppConfig.String("redis_add_port"))
32 err := redis.InitWithDb(100, redisSource, beego.AppConfig.String("redis_auth"), "0") 31 err := redis.InitWithDb(100, redisSource, beego.AppConfig.String("redis_auth"), "0")
  32 + log.Info(fmt.Sprintf("init redis:%v", redisSource))
33 if err != nil { 33 if err != nil {
34 log.Fatal("connect to redis error address:", beego.AppConfig.String("redis_add_port"), beego.AppConfig.String("redis_auth"), err) 34 log.Fatal("connect to redis error address:", beego.AppConfig.String("redis_add_port"), beego.AppConfig.String("redis_auth"), err)
35 //panic(err) 35 //panic(err)
@@ -41,6 +41,7 @@ func init() { @@ -41,6 +41,7 @@ func init() {
41 beego.AppConfig.String("mysql_port"), 41 beego.AppConfig.String("mysql_port"),
42 beego.AppConfig.String("mysql_db_name"), 42 beego.AppConfig.String("mysql_db_name"),
43 ) 43 )
  44 + log.Info(fmt.Sprintf("init mysql:%v", dataSource))
44 orm.NewBeeormEngine(config.Mysql{ 45 orm.NewBeeormEngine(config.Mysql{
45 //AliasName: "default", 46 //AliasName: "default",
46 DataSource: dataSource, 47 DataSource: dataSource,
@@ -55,7 +56,7 @@ func init() { @@ -55,7 +56,7 @@ func init() {
55 //Password:"ibfduqhfmgypbffe", //授权码 56 //Password:"ibfduqhfmgypbffe", //授权码
56 //IsUseSsl:true, 57 //IsUseSsl:true,
57 }) 58 })
58 - im.InitImClient(beego.AppConfig.String("net_im_base_url"), beego.AppConfig.String("net_im_app_key"), beego.AppConfig.String("net_im_app_secret")) 59 + //im.InitImClient(beego.AppConfig.String("net_im_base_url"), beego.AppConfig.String("net_im_app_key"), beego.AppConfig.String("net_im_app_secret"))
59 websocket.InitWebsocketConnmgrs(10) 60 websocket.InitWebsocketConnmgrs(10)
60 } 61 }
61 62
@@ -3,8 +3,10 @@ package routers @@ -3,8 +3,10 @@ package routers
3 import ( 3 import (
4 "github.com/astaxie/beego" 4 "github.com/astaxie/beego"
5 "github.com/prometheus/client_golang/prometheus/promhttp" 5 "github.com/prometheus/client_golang/prometheus/promhttp"
  6 + "net/http"
6 "opp/controllers" 7 "opp/controllers"
7 "opp/controllers/v1" 8 "opp/controllers/v1"
  9 + "opp/services/websocket"
8 ) 10 )
9 11
10 var nsV1 *beego.Namespace 12 var nsV1 *beego.Namespace
@@ -23,6 +25,7 @@ func init() { @@ -23,6 +25,7 @@ func init() {
23 ) 25 )
24 beego.AddNamespace(nsV1) 26 beego.AddNamespace(nsV1)
25 beego.SetStaticPath("/file/opp", beego.AppConfig.String("source_path")) 27 beego.SetStaticPath("/file/opp", beego.AppConfig.String("source_path"))
  28 + beego.SetStaticPath("/log/opp", beego.AppConfig.String("aliyun_logs_access"))
26 beego.Handler("/metrics", promhttp.Handler()) 29 beego.Handler("/metrics", promhttp.Handler())
27 - //beego.Handler("/upgrage", http.HandlerFunc(websocket.Upgrage)) 30 + beego.Handler("/upgrage", http.HandlerFunc(websocket.Upgrage))
28 } 31 }