Пример #1
0
 public IEnumerable<Log> Parse(string filePath)
 {
     var lineParser = new LineParser();
     foreach (var line in File.ReadLines(filePath))
     {
         var log = lineParser.Parse(line);
         if (log != null) yield return log;
     }
 }
Пример #2
0
 public void Test()
 {
     var target = new LineParser();
     var result = target.Parse(@"202.39.77.14 - - [06/Oct/2015:17:07:43 +0800] ""POST /cvs/ap_interface.php HTTP/1.1"" 200 289 328165");
     Assert.Equal("202.39.77.14", result.ClientIp);
     Assert.Equal("/cvs/ap_interface.php", result.Url);
     Assert.Equal(200, result.StatusCode);
     Assert.Equal(289, result.Bytes);
     Assert.Equal(328165, result.MicroSeconds);
 }