示例#1
0
        /// <summary>
        /// Function to print a message to the log.
        /// </summary>
        /// <param name="format">Format specifier for the logging.</param>
        /// <param name="values">Optional values to supply to the logger.</param>
        public static void Print(string format, params object[] values)
        {
            if ((_logFile == null) ||
                (_logFile.IsClosed))
            {
                return;
            }

            _logFile.Print(format, LoggingLevel.All, values);
        }
示例#2
0
        /// <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();
        }