Browse Source

add ui log releated

chenzk 3 days ago
parent
commit
6552d2655f

+ 4 - 1
CyberX8_Themes/UserControls/RinseUIControl.xaml.cs

@@ -1,4 +1,5 @@
-using MECF.Framework.Common.Device.Rinse;
+using Aitex.Core.RT.Log;
+using MECF.Framework.Common.Device.Rinse;
 using MECF.Framework.Common.OperationCenter;
 using System;
 using System.Collections.Generic;
@@ -140,11 +141,13 @@ namespace CyberX8_Themes.UserControls
 
         private void OpenClampValve_Click(object sender, RoutedEventArgs e)
         {
+            LOG.WriteLog(eEvent.EV_DEVICE_INFO, "", $"ClampValveOn");
             InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ClampValveOn");
         }
 
         private void CloseClampValve_Click(object sender, RoutedEventArgs e)
         {
+            LOG.WriteLog(eEvent.EV_DEVICE_INFO, "", $"ClampValveOff");
             InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ClampValveOff");
         }
 

+ 23 - 0
CyberX8_UI/App.config

@@ -1,5 +1,28 @@
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
+	
+	<configSections>
+		<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net " />
+	</configSections>
+	<log4net>
+		<appender name="UIfileAppender" type="log4net.Appender.RollingFileAppender">
+			<param name="Encoding" value="utf-8" />
+			<param name="File" value="Logs/log" />
+			<param name="AppendToFile" value="true" />
+			<param name="RollingStyle" value="Date" />
+			<param name="StaticLogFileName" value="false" />
+			<datePattern value="yyyyMMdd'.txt'" />
+			<layout type="log4net.Layout.PatternLayout,log4net">
+				<param name="ConversionPattern" value="%d%8p %m%n" />
+				<param name="Header" value="&#xA;----------------------开启UI--------------------------&#xA;" />
+			</layout>
+		</appender>
+		<root>
+			<level value="ALL" />
+			<appender-ref ref="UIfileAppender" />
+		</root>
+	</log4net>
+	
 	<startup>
 		<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
 	</startup>

+ 5 - 0
CyberX8_UI/App.xaml.cs

@@ -7,6 +7,9 @@ using System.Windows;
 using CyberX8_MainPages.Views;
 using CyberX8_UI.Views;
 using WPF.Themes.UserControls;
+using Aitex.Core.Util;
+using Aitex.Core.RT.Log;
+using Aitex.Common.Util;
 
 namespace CyberX8_UI
 {
@@ -26,6 +29,8 @@ namespace CyberX8_UI
                 WPFMessageBox.ShowError("Only One CyberX8_UI is allowed");
                 Environment.Exit(0);
             }
+            LogDefineManager.Initialize(PathManager.GetCfgDir() + "LogDefine.json");
+            Singleton<LogManager>.Instance.Initialize();
             base.OnStartup(e);           
         }
         protected override Window CreateShell()

File diff suppressed because it is too large
+ 1588 - 0
CyberX8_UI/Config/LogDefine.json


+ 3 - 0
CyberX8_UI/CyberX8_UI.csproj

@@ -156,6 +156,9 @@
     <Content Include="Config\UIMenu_permission.json">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
+    <Content Include="Config\LogDefine.json">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>

+ 10 - 1
Framework/Common/OperationCenter/InvokeService.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Reflection;
 using System.ServiceModel;
 using Aitex.Core.RT.Log;
 using Aitex.Core.RT.OperationCenter;
@@ -17,7 +18,15 @@ namespace MECF.Framework.Common.OperationCenter
                 //    EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation");
                 //    return;
                 //}
-
+                string argsList = "";
+                if (args.Length > 0)
+                {
+                    foreach (object arg in args)
+                    {
+                        argsList += (" " + arg.ToString());
+                    }
+                }
+                LOG.WriteLog(eEvent.EV_DEVICE_INFO, "", $"{operationName} was execute,parameter :{argsList}");
                 OP.DoOperation(operationName, args);
             }
             catch (Exception ex)