Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            PresetVersatileConsoleIO preset = new PresetVersatileConsoleIO();
            VersatileIO.SetHandler(preset);

            ReflectionUtil_Test test = new ReflectionUtil_Test();
            test.TypesInNamespace();

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a <see cref="Logger"/> to a given <paramref name="preset"/> with various settings.
        /// </summary>
        /// <param name="preset">Determines which preset is set up</param>
        /// <param name="filePath">Path for file output. <c>null</c> indicates no file output.</param>
        /// <param name="minOutputLogging">Minimum output log level</param>
        /// <param name="minFileLogging">Minimum file output log level</param>
        public static void Initialize(LoggerPresetType preset = LoggerPresetType.Console, string filePath = null,
			LogLevel minOutputLogging = LogLevel.Info, LogLevel minFileLogging = LogLevel.Debug)
        {
            Logger.Initialize(filePath, true, minOutputLogging, minFileLogging);

            switch (preset)
            {
                case LoggerPresetType.Console:
                    var versatile = new PresetVersatileConsoleIO(LogLevel.Interface.GetLevelColor());
                    Logger.Logging += (s, e) => VersatileIO.WriteLine(e.Message, e.Level.GetLevelColor());
                    Logger.LoggingPart += (s, e) => VersatileIO.Write(e.Message, e.Level.GetLevelColor());
                    break;
                case LoggerPresetType.FileOnly:
                    // already handled in Logger.
                    break;
                case LoggerPresetType.Debugger:
                    Logger.Logging += DebuggerLog;
                    Logger.LoggingPart += DebuggerLogPart;
                    break;
                default:
                    break;
            }
        }