- 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.

svn path=/trunk/tools/reactosdbg/; revision=1026
This commit is contained in:
Ged Murphy 2009-05-28 17:03:31 +00:00
parent 30f3891f5b
commit 4810e1fc08
2 changed files with 26 additions and 0 deletions

View File

@ -8,6 +8,7 @@ using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.Diagnostics;
using WeifenLuo.WinFormsUI.Docking;
using AbstractPipe;
using DebugProtocol;
@ -44,6 +45,29 @@ namespace RosDBG
{
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();
RegisterControl(m_RegView);

View File

@ -260,6 +260,8 @@ namespace RosDBG
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; }