Преглед изворни кода

Z991239-6298 #comment 规范化warn和error的日志

oilyang пре 3 месеци
родитељ
комит
8a9612f0cb
1 измењених фајлова са 8 додато и 7 уклоњено
  1. 8 7
      Module/mod_pinpad/PinPadFSM.cpp

+ 8 - 7
Module/mod_pinpad/PinPadFSM.cpp

@@ -7,6 +7,7 @@
 #include "RVCComm.h"
 #include "sm4.h"
 #include "publicFunExport.h"
+#include "RVCEventCode.h"
 #include <fstream>
 #if defined(RVC_OS_LINUX)
 #include <thread>
@@ -391,7 +392,7 @@ int CPinPadFSM::Initial()
 	eErrDev = GetEntityBase()->GetFunction()->OpenConfig(Config_Run, spConfig);
 	if (eErrDev != Error_Succeed)
 	{
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("read run cfg failed(sm).");
+		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode(RTAERR_CONFIG_OPEN_FAILED).setAPI(__FUNCTION__)("OpenConfig failed:%d", eErrDev);
 		m_bSMLoaded = false;
 		LogWarn(Severity_Middle, eErrDev, PinPad_UserErrorCode_Open_RunCfgFile_Failed, "Initial:OpenConfig");
 	}
@@ -458,7 +459,7 @@ int CPinPadFSM::Initial()
 			if (m_bUseBackupSN)
 			{
 				m_keySNSM = buffer;
-				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("because save failed, use backup sn:%s", m_keySNSM.GetData());
+				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA2618")("because save failed, use backup sn : %s", m_keySNSM.GetData());
 			}
 		}
 		delete[] buffer;
@@ -765,7 +766,7 @@ ErrorCodeEnum CPinPadFSM::GetEncryptText(SpReqAnsContext<PinPadService_GetInputS
 				}
 				push_char(buf, &readed, '*');
 			}else{
-				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("else[%d]",btCh);
+				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setResultCode("RTA2619")("else[%d]", btCh);
 			}
 
 		}
@@ -981,7 +982,7 @@ int CPinPadFSM::LoadKeySM(SpReqAnsContext<PinPadService_LoadKeysSM_Req, PinPadSe
 	eErr = spEntityFunction->OpenConfig(Config_Run, spConfig);
 	if (eErr != Error_Succeed)
 	{
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("LoadKeySM::OpenConfig failed,eErr:%d", eErr);
+		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setResultCode(RTAERR_CONFIG_OPEN_FAILED).setAPI(__FUNCTION__)("OpenConfig failed,eErr:%d", eErr);
 		spConfig = NULL;
 		ctx->Answer(eErr, PinPad_UserErrorCode_Open_RunCfgFile_Failed);
 		return 0;
@@ -1068,7 +1069,7 @@ int CPinPadFSM::LoadKeySM(SpReqAnsContext<PinPadService_LoadKeysSM_Req, PinPadSe
 		eErr = spConfig->WriteConfigValueInt("Load", "SM", 1);
 		if (eErr != Error_Succeed)
 		{
-			DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setResultCode(GetEntityBase()->GetFunction()->UserCodeToRTACode(PinPad_UserErrorCode_Write_RunCfgFile_Failed))("写密钥加载标识失败:%s", SpStrError(eErr));
+			DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setResultCode(RTAERR_CONFIG_WRITE_FAILED)("写密钥加载标识失败:%s", SpStrError(eErr));
 			LogWarn(Severity_Middle, Error_Unexpect, PinPad_UserErrorCode_Write_RunCfgFile_Failed, CSimpleStringA::Format("写密钥加载标识失败:%s", SpStrError(eErr)));
 		}
 
@@ -1076,7 +1077,7 @@ int CPinPadFSM::LoadKeySM(SpReqAnsContext<PinPadService_LoadKeysSM_Req, PinPadSe
 		{
 			if ((eErr = spConfig->WriteConfigValue("Load", "SN_SM", ctx->Req.reserved3)) != Error_Succeed)
 			{
-				DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setResultCode(GetEntityBase()->GetFunction()->UserCodeToRTACode(PinPad_UserErrorCode_Write_RunCfgFile_Failed))("写密钥序号失败:%s", SpStrError(eErr));
+				DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setResultCode(RTAERR_CONFIG_WRITE_FAILED)("写密钥序号失败:%s", SpStrError(eErr));
 				LogWarn(Severity_Middle, Error_Unexpect, PinPad_UserErrorCode_Write_RunCfgFile_Failed, CSimpleStringA::Format("写密钥序号失败:%s", SpStrError(eErr)));
 			}
 			m_keySNSM = ctx->Req.reserved3;
@@ -1432,7 +1433,7 @@ ErrorCodeEnum CPinPadFSM::GetEncryptTextJS(SpReqAnsContext<PinPadService_GetInpu
 				push_char(buf, &readed, '*');
 			}
 			else {
-				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("else[%d]", btCh);
+				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setResultCode("RTA2619")("else[%d]", btCh);
 			}
 
 		}