/// <summary> /// Initializes the <see cref="Gorgon"/> class. /// </summary> static Gorgon() { PlugIns = new GorgonPlugInFactory(); Log = new GorgonLogFile(LogFile, "Tape_Worm"); // Re-open the log if it's closed. if (Log.IsClosed) { try { Log.Open(); } #if DEBUG catch (Exception ex) { // Only note this in DEBUG mode. GorgonDialogs.ErrorBox(ApplicationForm, ex); } #else // ReSharper disable EmptyGeneralCatchClause catch { // We don't care if logging works or not in release mode. } // ReSharper restore EmptyGeneralCatchClause #endif } GorgonException.Log = Log; Log.Print("Initializing...", LoggingLevel.All); Log.Print("Architecture: {0}", LoggingLevel.Verbose, GorgonComputerInfo.PlatformArchitecture); Log.Print("Processor count: {0}", LoggingLevel.Verbose, GorgonComputerInfo.ProcessorCount); Log.Print("Installed Memory: {0}", LoggingLevel.Verbose, GorgonComputerInfo.TotalPhysicalRAM.FormatMemory()); Log.Print("Available Memory: {0}", LoggingLevel.Verbose, GorgonComputerInfo.AvailablePhysicalRAM.FormatMemory()); Log.Print("Operating System: {0} ({1})", LoggingLevel.Verbose, GorgonComputerInfo.OperatingSystemVersionText, GorgonComputerInfo.OperatingSystemArchitecture); // Default to using 10 milliseconds of sleep time when the application is not focused. UnfocusedSleepTime = 10; // Initializing application timing. GorgonTiming.Reset(); }
/// <summary> /// Function to open the log file for writing. /// </summary> public static void Open() { _logFile = new GorgonLogFile("Gorgon.Editor", "Tape_Worm"); try { _logFile.Open(); } #if DEBUG catch (Exception ex) { // If we can't open the log file in debug mode, let us know about it. GorgonDialogs.ErrorBox(null, ex); } #else catch { // Purposely left empty. We don't care about the log file in release mode. } #endif }