コード例 #1
0
        /// <summary>
        /// Renders the given log file to the given output.
        /// </summary>
        /// <param name="logFile">The log file.</param>
        /// <param name="output">A StreamWriter or Console.Out etc</param>
        public static void ConvertLog(string logFile, TextWriter output)
        {
            var writer = new IndentTextWriter(output);

            Extract(logFile, LogConverter.DefaultValidator, info => {
                LogConverter.ParsePacket(info, writer);
            });
        }
コード例 #2
0
        /// <summary>
        /// Renders the given log file to the given output.
        /// </summary>
        /// <param name="output">A StreamWriter or Console.Out etc</param>
        public static void ConvertLog(string logFile, TextWriter output, bool singleLine)
        {
            var writer = new IndentTextWriter(output);

            try
            {
                var lines = File.ReadAllLines(logFile);
                Extract(lines, singleLine, info => LogConverter.ParsePacket(info, writer),
                        LogConverter.DefaultValidator);
            }
            catch (Exception e)
            {
                throw new Exception(string.Format("Failed to parse log-file \"{0}\"", logFile), e);
            }
        }