/[RomCheater]/trunk/RomCheater/Main.cs
ViewVC logotype

Diff of /trunk/RomCheater/Main.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/RomCheater/Main.cs	2014/04/15 14:58:01	813
+++ trunk/RomCheater/Main.cs	2014/04/15 15:58:50	814
@@ -1,16 +1,16 @@
-#region Logging Defines
-// include this any class or method that required logging, and comment-out what is not needed
+//#region Logging Defines
+//// include this any class or method that required logging, and comment-out what is not needed
 
-#region Enabled logging levels
-#define LOGGING_ENABLE_INFO
-#define LOGGING_ENABLE_WARN
-#define LOGGING_ENABLE_DEBUG
-#define LOGGING_ENABLE_VERBOSEDEBUG
-#define LOGGING_ENABLE_ERROR
-#define LOGGING_ENABLE_VERBOSEERROR
-#define LOGGING_ENABLE_PROFILER
-#endregion
-#endregion
+//#region Enabled logging levels
+//#define LOGGING_ENABLE_INFO
+//#define LOGGING_ENABLE_WARN
+//#define LOGGING_ENABLE_DEBUG
+//#define LOGGING_ENABLE_VERBOSEDEBUG
+//#define LOGGING_ENABLE_ERROR
+//#define LOGGING_ENABLE_VERBOSEERROR
+//#define LOGGING_ENABLE_PROFILER
+//#endregion
+//#endregion
 //#define FORCE_ALL_LOGGING_FLAGS // when defined will force logging flags to ALL
 #define SHOW_DEBUG_MENU // when defined will show the debug menu or else it will be hidden
 using System;
@@ -40,6 +40,8 @@
 {
     public partial class Main : Form
     {
+        private ushort Logger_flags = 0;
+        private LogLevel logging_level = LogLevel.kLogLevel_All;
         const string DockPanelConfig = "RomCheater-DockPanel.conf";
         private SettingSubscriber SettingsSubscriber;
         private bool m_bSaveLayout = true;
@@ -71,12 +73,12 @@
         //static Main() { SettingSubscriber.AddSubscriber(new Main(), Settings.Default); }
         //private const string t = "RomCheater";
         #region LogWriterSupport
-        //static LogWriter _LoggerInstance;
-        //static LogWriter LoggerInstance
-        //{
-        //    get { return _LoggerInstance; }
-        //    set { _LoggerInstance = value; }
-        //}
+        static LogWriter _LoggerInstance;
+        static LogWriter LoggerInstance
+        {
+            get { return _LoggerInstance; }
+            set { _LoggerInstance = value; }
+        }
         #endregion
 
 
@@ -192,6 +194,7 @@
         public void SetupDocks()
         {
             m_LogWindow = new FloatingLogWindow();
+            LoggerInstance = m_LogWindow.Logwriter;
             m_AboutBox = new FloatingAboutBox();
             m_RamDump = new FloatingRamDumperDialog();
             m_PIDSelector = new FloatingPIDSelector();
@@ -343,7 +346,7 @@
         public void ShowLogWindow()
         {
             if (m_LogWindow == null || m_LogWindow.IsDisposed) { m_LogWindow = new FloatingLogWindow(); }
-            //LoggerInstance = m_LogWindow.Logwriter;
+            LoggerInstance = m_LogWindow.Logwriter;
             //LoggerInstance.CreateNewLog(false);
             m_LogWindow.Show(dockPanel, DockState.DockBottom);       
         }
@@ -441,22 +444,25 @@
             mnuDebug.Visible = false;
 #endif
             SettingsSubscriber = new SettingSubscriber();
-            SettingsSubscriber.AddSubscriber(this, Settings.Default); 
-            load_loggerflags();
+            SettingsSubscriber.AddSubscriber(this, Settings.Default);            
             SetupDocks();
-            //LoggerInstance = m_LogWindow.Logwriter;
-            //LoggerInstance.CreateNewLog(false);
-            //logger.ForceLog.Info.WriteLine("LoggingFlags = 0x{0:x4} ({1})", logger.GetLoggingFlags().Value, logger.GetLoggingFlags().Name);
-            load_plugins();
-            //if (no_console_redirect)
-            //    LoggerInstance.RedirectConsoleOutput = false;           
+            LoggerInstance = m_LogWindow.Logwriter;
+            load_loggerflags();
+            load_plugins();      
         }
         private void load_loggerflags()
         {
-            //logger.SetLoggingFlags(Logging.Properties.Settings.Default.LoggingFlags);
+#warning LoggingFlags setting needs to be changed to Uint32 instead of Uint16
+            logging_level = (LogLevel)(Logging.Properties.Settings.Default.LoggingFlags);            
+           logging_level = new LoggingFlagsConverter(Logging.Properties.Settings.Default.LoggingFlags).ConvertFlags();
 #if FORCE_ALL_LOGGING_FLAGS
-            //logger.SetLoggingFlags(loggerflags.ALL);
-#endif
+            logging_level = LogLevel.kLogLevel_All;
+#endif            
+           gLog.CreateLog(LoggingConstants.AppFullLogPath, true, logging_level, new EventHandler<LoggerOnFlushEventArgs>(Log_OnFlush), LoggerInstance.Log);
+        }
+
+        private void Log_OnFlush(object sender, LoggerOnFlushEventArgs e)
+        {           
         }
         private void load_plugins() { load_plugins(false); }
         private void load_plugins_silent() { load_plugins(true); }

 

  ViewVC Help
Powered by ViewVC 1.1.22