浏览代码

#IQRV #comment 日志库优化改造

80374374 9 月之前
父节点
当前提交
f18d5ab28a

+ 1 - 1
DevAdapter/CMakeLists.txt

@@ -297,7 +297,7 @@ if(DEVADAPTER_USING_CONAN)
         #CardLibDB_CMB.db3
         conan_cmake_run(REQUIRES VendorDLL/2024.11.1401@LR04.02_VendorLib/testing
             BASIC_SETUP CMAKE_TARGETS)
-        set(SELF_CONAN_LIB_NAME self/2024.1025.01@LR04.02_VendorLib/testing)
+        set(SELF_CONAN_LIB_NAME self/2024.1217.01@LR04.02_VendorLib/testing)
         add_subdirectory(self)
     endif(MSVC)
 

+ 3 - 0
DevAdapter/liblog4vendor/env_deal.cpp

@@ -74,10 +74,13 @@ namespace cmb {
 
 	bool env_log_config::retrieve_env_value()
 	{
+        record_type = record_level = module_name = record_path = seal_module_name = "";
+
 		env_deal("VENDOR_RECODE_TYPE").get(record_type);
 		env_deal("VENDOR_RECODE_LEVEL").get(record_level);
 		env_deal("VENDOR_DLL_NAME").get(module_name);
 		env_deal("VENDOR_LOG_PATH").get(record_path);
+		env_deal("VENDOR_PARENT_NAME").get(seal_module_name);
         return true;
 	}
 }

+ 1 - 1
DevAdapter/liblog4vendor/env_deal.h

@@ -28,7 +28,7 @@ namespace cmb {
 		std::string record_type;
 		std::string record_path;
 		std::string module_name;
-
+		std::string seal_module_name;
 		bool retrieve_env_value();
 	};
 }

+ 4 - 0
DevAdapter/liblog4vendor/log4vendor.cpp

@@ -124,6 +124,10 @@ namespace cmb {
             }
 #endif //_MSC_VER
 		}
+		else if (!env.seal_module_name.empty()) {
+			config->dev_name = "vendor_";
+			config->dev_name += env.seal_module_name.c_str();
+		}
 		config->log_dir = env.record_path;
 	}
 

+ 4 - 2
Module/include/DevEntityCommBase.hpp

@@ -228,24 +228,26 @@ inline void CDevAdptEntityBase::InitializeVendorLogSwitch()
 
 	struct VendorLogConfig {
 
-		VendorLogConfig() :strLevel("OFF"), strType("FILE"), strDllName(""), strLogPath("") {}
+		VendorLogConfig() :strLevel("OFF"), strType("FILE"), strDllName(""), strLogPath(""), strModuleName(""){}
 
 		CSimpleStringA strLevel;
 		CSimpleStringA strType;
 		CSimpleStringA strDllName;
 		CSimpleStringA strLogPath;
+		CSimpleStringA strModuleName;
 
 		void Settle()  {
 			toolkit_setenv("VENDOR_RECODE_LEVEL", strLevel);
 			toolkit_setenv("VENDOR_RECODE_TYPE", strType);
 			toolkit_setenv("VENDOR_DLL_NAME", strDllName);
 			toolkit_setenv("VENDOR_LOG_PATH", strLogPath);
+			toolkit_setenv("VENDOR_PARENT_NAME", strModuleName);
 		}
 
 	} stLogConfig;
 
 	stLogConfig.strDllName = vendorLibInfo.toLibNameString().GetData();
-
+	stLogConfig.strModuleName = GetEntityName();
 	CSmartPointer<IConfigInfo> centerConfig;
 	GetFunction()->OpenConfig(Config_CenterSetting, centerConfig);