上传日志输出控制
This commit is contained in:
parent
9d91d35501
commit
f1788349d6
@ -34,8 +34,7 @@ func (this *Options) LoadConfig(settings map[string]interface{}) (err error) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if this.Log = log.NewTurnlog(this.Debug, log.Clone("", 4)); this.Log == nil {
|
||||
if this.Log = log.NewTurnlog(true, log.Clone("", 4)); this.Log == nil {
|
||||
err = errors.New("log is nil")
|
||||
}
|
||||
return
|
||||
|
@ -30,11 +30,9 @@ type msghandle struct {
|
||||
|
||||
//组件参数
|
||||
type CompOptions struct {
|
||||
Debug bool
|
||||
}
|
||||
|
||||
func (this *CompOptions) LoadConfig(settings map[string]interface{}) (err error) {
|
||||
this.Debug = true
|
||||
if settings != nil {
|
||||
err = mapstructure.Decode(settings, this)
|
||||
}
|
||||
@ -166,16 +164,14 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag
|
||||
)
|
||||
} else {
|
||||
reply.Reply = session.Polls()
|
||||
if this.options.Debug {
|
||||
// log.Debugf("[Handle Api] t:%v m:%s uid:%s req:%v reply:%v", time.Since(stime), method, args.UserId, msg, reply)
|
||||
log.Debug("[Handle Api]",
|
||||
log.Field{Key: "t", Value: time.Since(stime).Milliseconds()},
|
||||
log.Field{Key: "m", Value: method},
|
||||
log.Field{Key: "uid", Value: args.UserId},
|
||||
log.Field{Key: "req", Value: msg},
|
||||
log.Field{Key: "reply", Value: reply.String()},
|
||||
)
|
||||
}
|
||||
// log.Debugf("[Handle Api] t:%v m:%s uid:%s req:%v reply:%v", time.Since(stime), method, args.UserId, msg, reply)
|
||||
log.Debug("[Handle Api]",
|
||||
log.Field{Key: "t", Value: time.Since(stime).Milliseconds()},
|
||||
log.Field{Key: "m", Value: method},
|
||||
log.Field{Key: "uid", Value: args.UserId},
|
||||
log.Field{Key: "req", Value: msg},
|
||||
log.Field{Key: "reply", Value: reply.String()},
|
||||
)
|
||||
}
|
||||
} else { //未找到消息处理函数
|
||||
log.Errorf("[Handle Api] no found handle %s", method)
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
func newSys(options *Options) (sys *DB, err error) {
|
||||
sys = &DB{
|
||||
options: options,
|
||||
servers: make(map[string]*DBConn),
|
||||
data: make(map[string]*ModelDataExpired),
|
||||
}
|
||||
if err = sys.init(); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user