فهرست منبع

Log类改成Logger

tanghai 13 سال پیش
والد
کامیت
4f4852b064

+ 1 - 1
CSharp/App/Modules/BehaviorTree/BehaviorTreeLayout.cs

@@ -126,7 +126,7 @@ namespace Modules.BehaviorTree
 			treeNode.Prelim = prelim;
 			treeNode.Modify = modify;
 
-			Log.Debug("Num: " + treeNode.Num + " Prelim: " + treeNode.Prelim + " Modify: " + treeNode.Modify);
+			Logger.Debug("Num: " + treeNode.Num + " Prelim: " + treeNode.Prelim + " Modify: " + treeNode.Modify);
 		}
 
 		private static void CalculateRelativeXAndY(TreeNodeViewModel treeNode, int level, double totalModify)

+ 4 - 5
CSharp/App/Modules/Robot/RobotViewModel.cs

@@ -11,9 +11,8 @@ namespace Modules.Robot
 	[Export(contractType: typeof (RobotViewModel)), PartCreationPolicy(creationPolicy: CreationPolicy.NonShared)]
 	internal class RobotViewModel : NotificationObject
 	{
-		private Host host;
+		private readonly Host host;
 		private string logText = "";
-		private IEventAggregator eventAggregator = new EventAggregator();
 		private readonly DispatcherTimer timer = new DispatcherTimer(DispatcherPriority.Normal)
 		{
 			Interval = new TimeSpan(0, 0, 0, 0, 50)
@@ -49,12 +48,12 @@ namespace Modules.Robot
 		{
 			try
 			{
-				Peer peer = await host.ConnectAsync(new Address { Host = "192.168.10.246", Port = 8901 }, 2, 0);
-				Log.Debug("peer data: " + peer.Data);
+				Peer peer = await host.ConnectAsync(new Address { Host = "192.168.10.246", Port = 8901 }, 2);
+				Logger.Debug("peer data: " + peer.Data);
 			}
 			catch (ENetException e)
 			{
-				Log.Debug(e.Message);
+				Logger.Debug(e.Message);
 			}
 		}
 

+ 1 - 1
CSharp/Platform/ELog/ELog.csproj

@@ -44,7 +44,7 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="Log.cs" />
+    <Compile Include="Logger.cs" />
     <Compile Include="ILog.cs" />
     <Compile Include="NLog.cs" />
   </ItemGroup>

+ 1 - 0
CSharp/Platform/ELog/ILog.cs

@@ -3,6 +3,7 @@ namespace ELog
 {
     public interface ILog
     {
+		void Trace(string message);
 	    void Debug(string message);
     }
 }

+ 6 - 1
CSharp/Platform/ELog/Log.cs → CSharp/Platform/ELog/Logger.cs

@@ -1,10 +1,15 @@
 
 namespace ELog
 {
-	public static class Log
+	public static class Logger
 	{
 		private static readonly ILog logger = new NLog();
 
+		public static void Trace(string message)
+		{
+			logger.Trace(message);
+		}
+
 		public static void Debug(string message)
 		{
 			logger.Debug(message);

+ 6 - 1
CSharp/Platform/ELog/NLog.cs

@@ -4,7 +4,12 @@ namespace ELog
 {
 	public class NLog: ILog
 	{
-		private readonly Logger logger = LogManager.GetCurrentClassLogger();
+		private readonly global::NLog.Logger logger = LogManager.GetCurrentClassLogger();
+
+		public void Trace(string message)
+		{
+			logger.Trace(message);
+		}
 
 		public void Debug(string message)
 		{

+ 2 - 2
CSharp/Platform/Hooks/RecvHook.cs

@@ -24,7 +24,7 @@ namespace Hooks
 			}
 			catch (Exception)
 			{
-				Log.Debug("Error creating recv Hook");
+				Logger.Debug("Error creating recv Hook");
 				throw;
 			}
 		}
@@ -45,7 +45,7 @@ namespace Hooks
 		//		TextWriter tw = new StreamWriter("recv.txt");
 		//		tw.Write(s);
 		//		tw.Close();
-		//		Log.Debug(string.Format("Hooked:>{0}", s));
+		//		Logger.Debug(string.Format("Hooked:>{0}", s));
 		//	}
 		//	return bytesCount;
 		//}

+ 1 - 1
CSharp/Platform/Hooks/SendHook.cs

@@ -24,7 +24,7 @@ namespace Hooks
 			}
 			catch (Exception)
 			{
-				Log.Debug("Error creating send Hook");
+				Logger.Debug("Error creating send Hook");
 				throw;
 			}
 		}