Browse Source

#IQRV #comment [CardReadAdapter] 应用日志改造

gifur 3 years ago
parent
commit
df49b9f7c5

File diff suppressed because it is too large
+ 149 - 166
Module/mod_CardReadAdapter/CardReadAdapterFSM.cpp


+ 11 - 46
Module/mod_CardReadAdapter/CardReadAdapterFSM.h

@@ -187,45 +187,12 @@ public:
 	{
 		if (ctx != NULL)
 		{
-			Dbg("card issue unhandled");
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("card issue unhandled");
 			ctx->Answer(Error_InvalidState);
 		}
 	}
 };
-//class CardAcceptEvent : public FSMEvent
-//{
-//public:
-//	CardAcceptEvent() : FSMEvent(USER_EVT_CARD_ACCEPT){}
-//	~CardAcceptEvent(){}
-//	SpReqAnsContext<CardReadAdapterService_Read_Req, CardReadAdapterService_Read_Ans>::Pointer ctx;
-//	virtual void OnUnhandled()
-//	{
-//		if (ctx != NULL)
-//		{
-//			Dbg("card accept unhandled");
-//			ctx->Answer(Error_InvalidState);
-//		}
-//	}
-//protected:
-//private:
-//};
-//class CardAcceptFinishedEvent : public FSMEvent
-//{
-//public:
-//	CardAcceptFinishedEvent() : FSMEvent(USER_EVT_CARD_ACCEPT_FINISHED){}
-//	~CardAcceptFinishedEvent(){}
-//	SpReqAnsContext<CardReadAdapterService_Read_Req, CardReadAdapterService_Read_Ans>::Pointer ctx;
-//	virtual void OnUnhandled()
-//	{
-//		if (ctx != NULL)
-//		{
-//			Dbg("card accept finished unhandled");
-//			ctx->Answer(Error_InvalidState);
-//		}
-//	}
-//protected:
-//private:
-//};
+
 class CancelReadEvent : public FSMEvent
 {
 public:
@@ -233,7 +200,7 @@ public:
 	~CancelReadEvent(){}
 	virtual void OnUnhandled()
 	{
-		Dbg("card cancel accept unhandled");
+		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("card cancel accept unhandled");
 	}
 };
 class ReadWaitMoreEvent : public FSMEvent
@@ -243,7 +210,7 @@ public:
 	~ReadWaitMoreEvent(){}
 	virtual void OnUnhandled()
 	{
-		Dbg("ReadWaitMore unhandled");
+		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("ReadWaitMore unhandled");
 	}
 };
 class CardReadEvent : public FSMEvent
@@ -256,7 +223,7 @@ public:
 	{
 		if (ctx != NULL)
 		{
-			Dbg("card read unhandled");
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("card read unhandled");
 			ctx->Answer(Error_InvalidState);
 		}
 	}
@@ -273,8 +240,7 @@ public:
 	{
 		if (ctx != NULL)
 		{
-			Dbg("card read unhandled(new)");
-			//ctx->Answer(Error_InvalidState);
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("card read unhandled(new)");
 		}
 	}
 protected:
@@ -365,7 +331,7 @@ public:
 	{
 		if (ctx != NULL)
 		{
-			Dbg("card read unhandled");
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("card read unhandled");
 			ctx->Answer(Error_InvalidState);
 		}
 	}
@@ -382,8 +348,7 @@ public:
 	{
 		if (ctx != NULL)
 		{
-			Dbg("card read unhandled(new)");
-			//ctx->Answer(Error_InvalidState);
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("card read unhandled(new)");
 		}
 	}
 };
@@ -397,7 +362,7 @@ public:
 	{
 		if (ctx != NULL)
 		{
-			Dbg("SetSomeFlag unhandled");
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("SetSomeFlag unhandled");
 			ctx->Answer(Error_InvalidState);
 		}
 	}
@@ -412,7 +377,7 @@ public:
 	{
 		if (ctx != NULL)
 		{
-			Dbg("QueryCardInfo unhandled");
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("QueryCardInfo unhandled");
 			ctx->Answer(Error_InvalidState);
 		}
 	}
@@ -704,7 +669,7 @@ public:
 	{
 		if (ctx != NULL)
 		{
-			Dbg("GetDevInfo unhandled");
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("GetDevInfo unhandled");
 			ctx->Answer(Error_InvalidState);
 		}
 	}

+ 4 - 4
Module/mod_CardReadAdapter/mod_CardReadAdapter.cpp

@@ -12,9 +12,9 @@
 void CardReadAdapterServerSession::Handle_Read(SpReqAnsContext<CardReadAdapterService_Read_Req, CardReadAdapterService_Read_Ans>::Pointer ctx)
 {
 	LOG_FUNCTION();
-	Dbg("Module:%d,lightPos:%d,bus data size:%d",ctx->Req.module,ctx->Req.lightPos,ctx->Req.businessData.GetLength());
+	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("Module:%d,lightPos:%d,bus data size:%d",ctx->Req.module,ctx->Req.lightPos,ctx->Req.businessData.GetLength());
 	if (ctx->Req.reserved1.GetCount() > 0)
-		Dbg("reserved1[0]:%d",ctx->Req.reserved1[0]);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("reserved1[0]:%d",ctx->Req.reserved1[0]);
 	m_pEntity->Read(ctx);
 }
 
@@ -52,7 +52,7 @@ void CardReadAdapterServerSession::Handle_PreOnline(SpReqAnsContext<CardReadAdap
 		m_pEntity->PreOnline(ctx);
 	else
 	{
-		Dbg("except for kaku,other can't use preonline directly.");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("except for kaku,other can't use preonline directly.");
 		ctx->Answer(Error_Unexpect);
 	}
 }
@@ -193,7 +193,7 @@ void CCardReadAdapterEntity::OnBroadcastEvent(CUUID SubID, const char *pszEntity
 	if (dwMessageSignature != eMsgSig_FetchCard && dwMessageSignature != eMsgSig_SCIConnect && dwMessageSignature != eMsgSig_ConnectStatus)
 		return;
 
-	Dbg("msg:%s,%d,%d",pszEntityName,dwMessageId,dwMessageSignature);
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("msg:%s,%d,%d",pszEntityName,dwMessageId,dwMessageSignature);
 	if (_strnicmp(pszEntityName, "CardIssuer", strlen("CardIssuer")) == 0)
 	{
 		if (dwMessageSignature == eMsgSig_FetchCard)

+ 3 - 3
Module/mod_CardReadAdapter/mod_CardReadAdapter.h

@@ -99,7 +99,7 @@ public:
 	}
 	virtual CServerSessionBase* OnNewSession(const char*,const char*)
 	{
-		Dbg("A new connecting request arrived.");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("A new connecting request arrived.");
 		m_bNewSessionInit = true;
 		return new CardReadAdapterServerSession(this);
 	}
@@ -263,9 +263,9 @@ public:
 	}
 	void SetSomeFlag(SpReqAnsContext<CardReadAdapterService_SetSomeFlag_Req, CardReadAdapterService_SetSomeFlag_Ans>::Pointer ctx)
 	{
-		Dbg("set issue flag to %d.", ctx->Req.IssueBusiness);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("set issue flag to %d.", ctx->Req.IssueBusiness);
 		if (ctx->Req.reserved1.GetCount() > 0)
-			Dbg("hoppernum:%d", ctx->Req.reserved1[0]);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("hoppernum:%d", ctx->Req.reserved1[0]);
 		SetSomeFlagEvent *pEvt = new SetSomeFlagEvent();
 		pEvt->ctx = ctx;
 		m_fsm.PostEventFIFO(pEvt);

Some files were not shown because too many files changed in this diff