示例#1
0
        /// <summary>
        /// Initializes trace logging.
        /// </summary>
        /// <param name="CommandLine">Command line.</param>
        public static void InitLogging(string[] CommandLine)
        {
            // ensure UTF8Output flag is respected, since we are initializing logging early in the program.
            if (CommandLine.Any(Arg => Arg.Equals("-utf8output", StringComparison.InvariantCultureIgnoreCase)))
            {
                Console.OutputEncoding = new System.Text.UTF8Encoding(false, false);
            }

            UnrealBuildTool.Log.InitLogging(
                bLogTimestamps: CommandUtils.ParseParam(CommandLine, "-Timestamps"),
                InLogLevel: (UnrealBuildTool.LogEventType)Enum.Parse(typeof(UnrealBuildTool.LogEventType), CommandUtils.ParseParamValue(CommandLine, "-Verbose=", "Log")),
                bLogSeverity: true,
                bLogProgramNameWithSeverity: false,
                bLogSources: true,
                bLogSourcesToConsole: false,
                bColorConsoleOutput: true,
                TraceListeners: new TraceListener[]
            {
                new UEConsoleTraceListener(),
                // could return null, but InitLogging handles this gracefully.
                CreateLogFileListener(out LogFilename),
                //@todo - this is only used by GUBP nodes. Ideally we don't waste this 20MB if we are not running GUBP.
                new AutomationMemoryLogListener(),
            });
        }
示例#2
0
        /// <summary>
        /// Initializes trace logging.
        /// </summary>
        /// <param name="CommandLine">Command line.</param>
        public static void InitLogging(string[] CommandLine)
        {
            // ensure UTF8Output flag is respected, since we are initializing logging early in the program.
            if (CommandLine.Any(Arg => Arg.Equals("-utf8output", StringComparison.InvariantCultureIgnoreCase)))
            {
                Console.OutputEncoding = new System.Text.UTF8Encoding(false, false);
            }

            Timer = (CommandUtils.ParseParam(CommandLine, "-Timestamps"))? Stopwatch.StartNew() : null;
            var VerbosityLevel = CommandUtils.ParseParam(CommandLine, "-Verbose") ? TraceEventType.Verbose : TraceEventType.Information;
            var Filter         = new VerbosityFilter(VerbosityLevel);

            Trace.Listeners.Add(new AutomationConsoleTraceListener());
            FileLog = new AutomationFileTraceListener();
            Trace.Listeners.Add(FileLog);
            Trace.Listeners.Add(new AutomationMemoryLogListener());
            foreach (TraceListener Listener in Trace.Listeners)
            {
                Listener.Filter = Filter;
            }
        }