當前位置: 首頁>>代碼示例>>Golang>>正文


Golang logger.Trace函數代碼示例

本文整理匯總了Golang中github.com/idealeak/goserver/core/logger.Trace函數的典型用法代碼示例。如果您正苦於以下問題:Golang Trace函數的具體用法?Golang Trace怎麽用?Golang Trace使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Trace函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Start

func (tm *TimerMgr) Start() {
	logger.Trace("Timer Start")
	defer logger.Trace("Timer Start [ok]")

	tm.Object = basic.NewObject(core.ObjId_TimerId,
		"timer",
		Config.Options,
		tm)
	tm.UserData = tm

	core.LaunchChild(TimerModule.Object)
}
開發者ID:zwczou,項目名稱:goserver,代碼行數:12,代碼來源:timer.go

示例2: init

func (this *ModuleMgr) init() {
	logger.Trace("Start Initialize Modules")
	defer logger.Trace("Start Initialize Modules [ok]")
	for e := this.modules.Front(); e != nil; e = e.Next() {
		if me, ok := e.Value.(*ModuleEntity); ok && !me.quited {
			logger.Trace(me.module.ModuleName(), " Init...")
			me.module.Init()
			logger.Trace(me.module.ModuleName(), " Init [ok]")
		}
	}
	this.state = ModuleStateRun
}
開發者ID:zwczou,項目名稱:goserver,代碼行數:12,代碼來源:modulemgr.go

示例3: sendRoutine

func (s *TcpSession) sendRoutine() {

	defer func() {
		if err := recover(); err != nil {
			logger.Trace(s.Id, " ->close: Session.procSend err: ", err)
		}
		s.sc.encoder.FinishEncode(&s.Session)
		s.shutWrite()
		s.shutRead()
		s.Close()
	}()

	s.waitor.Add(1)
	defer s.waitor.Done()

	var (
		err  error
		data []byte
	)

	for !s.quit || len(s.sendBuffer) != 0 {
		select {
		case msg, ok := <-s.sendBuffer:
			if !ok {
				panic("[comm expt]sendBuffer chan closed")
			}

			if msg == nil {
				panic("[comm expt]normal close send")
			}

			if s.sc.IsInnerLink {
				var timeZero time.Time
				s.conn.SetWriteDeadline(timeZero)
			} else {
				if s.sc.WriteTimeout != 0 {
					s.conn.SetWriteDeadline(time.Now().Add(s.sc.WriteTimeout))
				}
			}

			data, err = s.sc.encoder.Encode(&s.Session, msg, s.conn)
			if err != nil {
				logger.Trace("s.sc.encoder.Encode err", err)
				if s.sc.IsInnerLink == false {
					panic(err)
				}
			}
			s.FirePacketSent(data)
			s.lastSndTime = time.Now()
		}
	}
}
開發者ID:zwczou,項目名稱:goserver,代碼行數:52,代碼來源:tcp_session.go

示例4: Start

func (e *Executor) Start() {
	logger.Trace("Executor Start")
	defer logger.Trace("Executor Start [ok]")

	e.Object = basic.NewObject(core.ObjId_ExecutorId,
		"executor",
		Config.Options,
		nil)
	e.c.NumberOfReplicas = WorkerVirtualNum
	e.UserData = e
	e.AddWorker(Config.Worker.WorkerCnt)

	core.LaunchChild(TaskExecutor.Object)
}
開發者ID:zwczou,項目名稱:goserver,代碼行數:14,代碼來源:executor.go

示例5: SendTransStart

func (tcs *TxCommSkeleton) SendTransStart(parent, me *transact.TransNodeParam, ud interface{}) bool {
	logger.Trace("TxCommSkeleton.SendTransStart")
	p := action.ContructTxStartPacket(parent, me, ud)
	if p == nil {
		return false
	}
	s := ServerSessionMgrSington.GetSession(me.AreaID, int(me.Ot), me.Oid)
	if s == nil {
		logger.Trace("TxCommSkeleton.SendTransStart s=nil")
		return false
	}

	s.Send(p)
	return true
}
開發者ID:zwczou,項目名稱:goserver,代碼行數:15,代碼來源:txcommskeleton.go

示例6: SendTransResult

func (tcs *TxCommSkeleton) SendTransResult(parent, me *transact.TransNodeParam, tr *transact.TransResult) bool {
	logger.Trace("TxCommSkeleton.SendTransResult")
	p := action.ContructTxResultPacket(parent, me, tr)
	if p == nil {
		return false
	}
	s := ServerSessionMgrSington.GetSession(parent.AreaID, int(parent.Ot), parent.Oid)
	if s == nil {
		logger.Trace("TxCommSkeleton.SendTransResult s=nil")
		return false
	}

	s.Send(p)
	return true
}
開發者ID:zwczou,項目名稱:goserver,代碼行數:15,代碼來源:txcommskeleton.go

示例7: SendCmdToTransNode

func (tcs *TxCommSkeleton) SendCmdToTransNode(tnp *transact.TransNodeParam, c transact.TransCmd) bool {
	logger.Trace("TxCommSkeleton.SendCmdToTransNode")
	p := action.ConstructTxCmdPacket(tnp, c)
	if p == nil {
		return false
	}
	s := ServerSessionMgrSington.GetSession(tnp.AreaID, int(tnp.Ot), tnp.Oid)
	if s == nil {
		logger.Trace("TxCommSkeleton.SendCmdToTransNode s=nil")
		return false
	}

	s.Send(p)
	return true
}
開發者ID:zwczou,項目名稱:goserver,代碼行數:15,代碼來源:txcommskeleton.go

示例8: OnRegiste

func (this *serviceMgr) OnRegiste(s *netlib.Session) {
	if this == nil || s == nil {
		return
	}

	if s.GetAttribute(SessionAttributeServiceFlag) == nil {
		return
	}
	attr := s.GetAttribute(SessionAttributeServerInfo)
	if attr != nil {
		if srvInfo, ok := attr.(*protocol.SSSrvRegiste); ok && srvInfo != nil {
			services := GetCareServicesBySession(srvInfo.GetType())
			for _, v1 := range services {
				if v2, has := this.servicesPool[v1]; has {
					for _, v3 := range v2 {
						func(si *protocol.ServiceInfo, sInfo *protocol.SSSrvRegiste) {
							pack := &protocol.SSServiceInfo{}
							proto.SetDefaults(pack)
							pack.Service = si
							logger.Trace("serviceMgr.OnRegiste Server Type=", sInfo.GetType(), " Id=", sInfo.GetId(), " Name=", sInfo.GetName(), " careful => Service=", si)
							s.Send(pack)
						}(v3, srvInfo)
					}
				}
			}
		}
	}
}
開發者ID:zwczou,項目名稱:goserver,代碼行數:28,代碼來源:servicemgr.go

示例9: init

func init() {
	netlib.RegisterFactory(int(protocol.MmoPacketID_PACKET_SC_GATEINFO), netlib.PacketFactoryWrapper(func() interface{} {
		return &protocol.SCGateInfo{}
	}))
	netlib.RegisterHandler(int(protocol.MmoPacketID_PACKET_SC_GATEINFO), netlib.HandlerWrapper(func(s *netlib.Session, pack interface{}) error {
		logger.Trace("receive gateinfo==", pack)
		if sr, ok := pack.(*protocol.SCGateInfo); ok {
			sc := &netlib.SessionConfig{
				Id:           int(sr.GetSrvId()),
				Type:         int(sr.GetSrvType()),
				Ip:           sr.GetIp(),
				Port:         int(sr.GetPort()),
				AuthKey:      sr.GetAuthKey(),
				WriteTimeout: 30,
				ReadTimeout:  30,
				IdleTimeout:  30,
				MaxDone:      20,
				MaxPend:      20,
				MaxPacket:    1024,
				RcvBuff:      1024,
				SndBuff:      1024,
				IsClient:     true,
				NoDelay:      true,
				FilterChain:  []string{"session-filter-trace", "session-filter-auth"},
			}
			sc.Init()
			err := netlib.Connect(core.CoreObject(), sc)
			if err != nil {
				logger.Warn("connect server failed err:", err)
			}
		}
		return nil
	}))
}
開發者ID:zwczou,項目名稱:goserver,代碼行數:34,代碼來源:packet_scgateinfo.go

示例10: RegisteHandler

func RegisteHandler(tt TransType, th TransHandler) {
	if _, exist := transactionHandlerPool[tt]; exist {
		panic(fmt.Sprintf("TransHandlerFactory repeate registe handler, type=%v", tt))
		return
	}
	logger.Trace("transact.RegisteHandler:", tt)
	transactionHandlerPool[tt] = th
}
開發者ID:zwczou,項目名稱:goserver,代碼行數:8,代碼來源:transfactory.go

示例11: OnExcute

func (this *traceTransHandler) OnExcute(tNode *transact.TransNode, ud interface{}) transact.TransExeResult {
	logger.Trace("traceTransHandler.OnExcute ")
	userData := &protocol.StructA{}
	err := netlib.UnmarshalPacketNoPackId(ud.([]byte), userData)
	if err == nil {
		logger.Tracef("==========%#v", userData)
	}
	return transact.TransExeResult_Success
}
開發者ID:zwczou,項目名稱:goserver,代碼行數:9,代碼來源:tx_trace.go

示例12: Process

func (this *TxCtrlCmdHandler) Process(session *netlib.Session, data interface{}) error {
	logger.Trace("TxCtrlCmdHandler.Process")
	if txcmd, ok := data.(*protocol.TransactCtrlCmd); ok {
		if !transact.ProcessTransCmd(transact.TransNodeID(txcmd.GetTId()), transact.TransCmd(txcmd.GetCmd())) {
			return errors.New("TxCtrlCmdHandler error, tid=" + strconv.FormatInt(txcmd.GetTId(), 16) + " cmd=" + strconv.Itoa(int(txcmd.GetCmd())))
		}
	}
	return nil
}
開發者ID:zwczou,項目名稱:goserver,代碼行數:9,代碼來源:txctrlcmd.go

示例13: Process

func (this *TxResultHandler) Process(session *netlib.Session, data interface{}) error {
	logger.Trace("TxResultHandler.Process")
	if tr, ok := data.(*protocol.TransactResult); ok {
		if !transact.ProcessTransResult(transact.TransNodeID(tr.GetMyTId()), transact.TransNodeID(tr.GetChildTId()), int(tr.GetRetCode()), tr.GetCustomData()) {
			return errors.New("TxResultHandler error, tid=" + strconv.FormatInt(tr.GetMyTId(), 16))
		}
	}
	return nil
}
開發者ID:zwczou,項目名稱:goserver,代碼行數:9,代碼來源:txresult.go

示例14: shutRead

func (s *TcpSession) shutRead() {
	if s.shutRecv {
		return
	}
	logger.Trace(s.Id, " shutRead")
	s.shutRecv = true
	if tcpconn, ok := s.conn.(*net.TCPConn); ok {
		tcpconn.CloseRead()
	}
}
開發者ID:zwczou,項目名稱:goserver,代碼行數:10,代碼來源:tcp_session.go

示例15: Process

func (this *PacketTransitHandler) Process(s *netlib.Session, data interface{}) error {
	logger.Trace("PacketTransitHandler.Process")
	if pr, ok := data.(*protocol.SSPacketTransit); ok {
		targetS := srvlib.ServerSessionMgrSington.GetSession(int(pr.GetSArea()), int(pr.GetSType()), int(pr.GetSId()))
		if targetS != nil {
			targetS.Send(pr.GetData())
		}
	}
	return nil
}
開發者ID:zwczou,項目名稱:goserver,代碼行數:10,代碼來源:transithandler.go


注:本文中的github.com/idealeak/goserver/core/logger.Trace函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。