[ros-diffs] [gedmurphy] 41184: - Setup the diagnostics on app load. - You can now use the static Trace.WriteLine method anywhere within the app to start making use of the log.

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Thu May 28 19:03:31 CEST 2009


Author: gedmurphy
Date: Thu May 28 21:03:31 2009
New Revision: 41184

URL: http://svn.reactos.org/svn/reactos?rev=41184&view=rev
Log:
- Setup the diagnostics on app load.
- You can now use the static Trace.WriteLine method anywhere within the app to start making use of the log.

Modified:
    trunk/tools/reactosdbg/RosDBG/MainWindow.cs
    trunk/tools/reactosdbg/RosDBG/Settings.cs

Modified: trunk/tools/reactosdbg/RosDBG/MainWindow.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/MainWindow.cs?rev=41184&r1=41183&r2=41184&view=diff
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/MainWindow.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/MainWindow.cs [iso-8859-1] Thu May 28 21:03:31 2009
@@ -8,6 +8,7 @@
 using System.Text;
 using System.Windows.Forms;
 using System.Reflection;
+using System.Diagnostics;
 using WeifenLuo.WinFormsUI.Docking;
 using AbstractPipe;
 using DebugProtocol;
@@ -43,6 +44,29 @@
         public MainWindow()
         {
             InitializeComponent();
+
+            // Setup the logger
+            try
+            {
+                if (Convert.ToBoolean(Settings.AppLogging))
+                {
+                    File.Delete(Settings.AppLogFile);
+                    FileStream traceLogFile = new FileStream(Settings.AppLogFile, FileMode.OpenOrCreate);
+                    Trace.Listeners.Add(new TextWriterTraceListener(traceLogFile));
+                    Trace.AutoFlush = true;
+                }
+            }
+            catch (DirectoryNotFoundException)
+            {
+                MessageBox.Show(String.Format("Logging: {0} does not exist.\n" +
+                                              "Please use the settings dialog to correct this",
+                                              Settings.AppLogFile));
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(String.Format("Failed to setup logging. Unexpected error:\n {0}",
+                                              ex.Message));
+            }
 
             mSymbolContext = new SymbolContext();
 

Modified: trunk/tools/reactosdbg/RosDBG/Settings.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/Settings.cs?rev=41184&r1=41183&r2=41184&view=diff
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/Settings.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/Settings.cs [iso-8859-1] Thu May 28 21:03:31 2009
@@ -260,6 +260,8 @@
         public static string Pipe { get { return mProperties.Pipe; } }
         public static string ComPort { get { return mProperties.Port; } }
         public static string Baudrate { get { return mProperties.Baudrate; } }
+        public static string AppLogging { get { return mProperties.AppLogging; } }
+        public static string AppLogFile { get { return mProperties.AppLogFile; } }
         public static Connect.ConnectionType SelectedConnType { 
             get { return mProperties.SelectedConnType; }
             set {  mProperties.SelectedConnType = value; }



More information about the Ros-diffs mailing list