Exemplo n.º 1
0
        public void GenerateLogFile()
        {
            int            count = int.Parse(_configParameters[Keys.ConsoleParameters][Keys.Count]);
            LogRecordParts recordParts;

            using (var _writer = new LogStringWriter(_configParameters[Keys.ConsoleParameters][Keys.FileName]))
            {
                for (int i = 0; i < count; i++)
                {
                    recordParts = _logRecordTemplate.GenerateRecord();
                    _writer.Write(_converter.Convert(recordParts));
                }
            }
        }
        public IEnumerable <LogRecordStringParts> Convert(IEnumerable <LogRecordParts> record)
        {
            IEnumerable <LogRecordStringParts> rerordList =
                record.Select(logRecordPart => _converter.Convert(logRecordPart)).Select(list => new LogRecordStringParts
            {
                IpAddress   = list[0],
                UserName    = list[1],
                UserId      = list[2],
                Date        = list[3],
                RequestLine = list[4],
                Code        = list[5],
                FileSize    = list[6]
            });

            return(rerordList);
        }