[Groonga-commit] groonga/groonga-log at 5059a18 [master] Remove needless "s" for consistency

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Sep 27 16:33:20 JST 2017


Kouhei Sutou	2017-09-27 16:33:20 +0900 (Wed, 27 Sep 2017)

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

  Message:
    Remove needless "s" for consistency

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

  Modified: lib/groonga-log/parser.rb (+12 -8)
===================================================================
--- lib/groonga-log/parser.rb    2017-09-27 16:28:19 +0900 (694acb8)
+++ lib/groonga-log/parser.rb    2017-09-27 16:33:20 +0900 (4b44fd9)
@@ -18,7 +18,11 @@
 module GroongaLog
   class Parser
     PATTERN =
-      /\A(?<year>\d{4})-(?<month>\d\d)-(?<day>\d\d) (?<hour>\d\d):(?<minutes>\d\d):(?<seconds>\d\d)\.(?<micro_seconds>\d+)\|(?<log_level>.)\|(?<context_id>.+?)\|(?<message>.*)/
+      /\A(?<year>\d{4})-(?<month>\d\d)-(?<day>\d\d)
+          \ (?<hour>\d\d):(?<minute>\d\d):(?<second>\d\d)\.(?<micro_second>\d+)
+          \|(?<log_level>.)
+          \|(?<context_id>.+?)
+          \|(?<message>.*)/x
 
     def parse(input)
       return to_enum(:parse, input) unless block_given?
@@ -31,14 +35,14 @@ module GroongaLog
         month = Integer(m['month'])
         day = Integer(m['day'])
         hour = Integer(m['hour'])
-        minutes = Integer(m['minutes'])
-        seconds = Integer(m['seconds'])
-        micro_seconds = Integer(m['micro_seconds'])
+        minute = Integer(m['minute'])
+        second = Integer(m['second'])
+        micro_second = Integer(m['micro_second'])
         log_level = log_level_to_symbol(m['log_level'])
         context_id = m['context_id']
         message = m['message']
         timestamp = Time.local(year, month, day,
-                               hour, minutes, seconds, micro_seconds)
+                               hour, minute, second, micro_second)
 
         record = {
           :timestamp => timestamp,
@@ -46,9 +50,9 @@ module GroongaLog
           :month => month,
           :day => day,
           :hour => hour,
-          :minutes => minutes,
-          :seconds => seconds,
-          :micro_seconds => micro_seconds,
+          :minute => minute,
+          :second => second,
+          :micro_second => micro_second,
           :log_level => log_level,
           :context_id => context_id,
           :message => message,

  Modified: test/test-parser.rb (+3 -3)
===================================================================
--- test/test-parser.rb    2017-09-27 16:28:19 +0900 (d043985)
+++ test/test-parser.rb    2017-09-27 16:33:20 +0900 (8677951)
@@ -25,9 +25,9 @@ class ParserTest < Test::Unit::TestCase
       :month => 7,
       :day => 19,
       :hour => 14,
-      :minutes => 41,
-      :seconds => 5,
-      :micro_seconds => 663978,
+      :minute => 41,
+      :second => 5,
+      :micro_second => 663978,
       :log_level => :notice,
       :context_id => "18c61700",
       :message => "spec:2:update:Object:32(type):8",
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20170927/8d61fc79/attachment-0001.htm 



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