优化日志
This commit is contained in:
parent
2612647e74
commit
dcb0396a73
@ -1,6 +1,7 @@
|
||||
package ga
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
galog "github.com/tuyou/galog"
|
||||
@ -24,7 +25,13 @@ func init() {
|
||||
func GAlogEvent(event string, userID string, deviceID string, properties map[string]interface{}) {
|
||||
newProperties := make(map[string]interface{})
|
||||
for k, v := range properties {
|
||||
newProperties["proj_"+k] = fmt.Sprintf("%v", v)
|
||||
// JSON encode the value
|
||||
jsonBytes, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
newProperties["proj_"+k] = fmt.Sprintf("%v", v) // 无法解析直接转为字符串
|
||||
continue
|
||||
}
|
||||
newProperties["proj_"+k] = string(jsonBytes)
|
||||
}
|
||||
properties = newProperties
|
||||
glogger.
|
||||
|
||||
@ -27,7 +27,6 @@ import (
|
||||
"server/game/mod/quest"
|
||||
GoUtil "server/game_util"
|
||||
"server/msg"
|
||||
telog "server/thinkdata"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
@ -1056,9 +1055,10 @@ func (p *Player) TeLog(Type string, Param map[string]interface{}) {
|
||||
if agent != nil {
|
||||
Param["Ip"] = agent.RemoteAddr().String()
|
||||
}
|
||||
go telog.Te.Track(p.GetPlayerBaseMod().GetName(), p.GetPlayerBaseMod().GetName(), Type, Param)
|
||||
Param["#zone_offset"] = -5
|
||||
// 游戏内TE日志
|
||||
// go telog.Te.Track(p.GetPlayerBaseMod().GetName(), p.GetPlayerBaseMod().GetName(), Type, Param)
|
||||
BaseMod := p.PlayMod.getBaseMod()
|
||||
|
||||
//途游GA
|
||||
go ga.GAlogEvent(Type, BaseMod.Account, "", Param)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user