[Groonga-commit] groonga/groonga-log at c83fa40 [master] Ignore invalid line

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Mar 8 11:50:18 JST 2018


Kouhei Sutou	2018-03-08 11:50:18 +0900 (Thu, 08 Mar 2018)

  New Revision: c83fa401b81ecdc287e024ed35e0ba6da0fdd077
  https://github.com/groonga/groonga-log/commit/c83fa401b81ecdc287e024ed35e0ba6da0fdd077

  Message:
    Ignore invalid line

  Modified files:
    lib/groonga-log/parser.rb
    test/test-parser.rb

  Modified: lib/groonga-log/parser.rb (+1 -0)
===================================================================
--- lib/groonga-log/parser.rb    2018-03-08 11:49:18 +0900 (3018275)
+++ lib/groonga-log/parser.rb    2018-03-08 11:50:18 +0900 (d17557e)
@@ -69,6 +69,7 @@ module GroongaLog
         end
 
         m = PATTERN.match(line)
+        next if m.nil?
 
         entry = Entry.new
 

  Modified: test/test-parser.rb (+6 -0)
===================================================================
--- test/test-parser.rb    2018-03-08 11:49:18 +0900 (1a94862)
+++ test/test-parser.rb    2018-03-08 11:50:18 +0900 (2511239)
@@ -74,6 +74,12 @@ class InputTest < Test::Unit::TestCase
                  entries.collect(&:log_level))
   end
 
+  def test_invalid_line
+    assert_equal([], parse(<<-LOG))
+invalid
+    LOG
+  end
+
   private
   def parse(log)
     parser = GroongaLog::Parser.new
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180308/52323102/attachment-0001.htm 



More information about the Groonga-commit mailing list
Back to archive index