[Groonga-commit] groonga/groonga-log at 8985fb5 [master] context_id -> pid

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Thu Nov 9 14:53:46 JST 2017


Kouhei Sutou	2017-11-09 14:53:46 +0900 (Thu, 09 Nov 2017)

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

  Message:
    context_id -> pid
    
    PID is integer.

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

  Modified: lib/groonga-log/parser.rb (+2 -2)
===================================================================
--- lib/groonga-log/parser.rb    2017-11-09 14:50:59 +0900 (0f54d61)
+++ lib/groonga-log/parser.rb    2017-11-09 14:53:46 +0900 (edf1ec8)
@@ -23,7 +23,7 @@ module GroongaLog
       /\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>.+?):)?
+          \|(?:(?<pid>\d+):)?
           \ (?<message>.*)/x
 
     def parse(input)
@@ -45,7 +45,7 @@ module GroongaLog
         statistic.timestamp = Time.local(year, month, day,
                                          hour, minute, second, micro_second)
         statistic.log_level = log_level_to_symbol(m['log_level'])
-        statistic.context_id = m['context_id']
+        statistic.pid = m['pid'].to_i if m['pid']
         statistic.message = m['message']
         yield statistic
       end

  Modified: lib/groonga-log/statistic.rb (+1 -1)
===================================================================
--- lib/groonga-log/statistic.rb    2017-11-09 14:50:59 +0900 (363fecc)
+++ lib/groonga-log/statistic.rb    2017-11-09 14:53:46 +0900 (0e72059)
@@ -17,7 +17,7 @@
 module GroongaLog
   class Statistic < Struct.new(:timestamp,
                                :log_level,
-                               :context_id,
+                               :pid,
                                :message)
   end
 end

  Modified: test/test-parser.rb (+4 -4)
===================================================================
--- test/test-parser.rb    2017-11-09 14:50:59 +0900 (2892fc7)
+++ test/test-parser.rb    2017-11-09 14:53:46 +0900 (126e4c0)
@@ -22,7 +22,7 @@ class ParserTest < Test::Unit::TestCase
     raw_statistic = {
       :timestamp => Time.local(2017, 7, 19, 14, 9, 5, 663978),
       :log_level => :notice,
-      :context_id => "29",
+      :pid => 29,
       :message => "spec:2:update:Object:32(type):8",
     }
     statistics = parse(<<-LOG)
@@ -59,11 +59,11 @@ class ParserTest < Test::Unit::TestCase
                  statistics.collect(&:log_level))
   end
 
-  def test_extract_field_no_context_id
+  def test_extract_field_no_pid
     raw_statistic = {
       :timestamp => Time.local(2017, 7, 19, 14, 9, 5, 663978),
       :log_level => :notice,
-      :context_id => nil,
+      :pid => nil,
       :message => "spec:2:update:Object:32(type):8",
     }
     statistics = parse(<<-LOG)
@@ -73,7 +73,7 @@ class ParserTest < Test::Unit::TestCase
                  statistics.collect(&:to_h))
   end
 
-  def test_log_level_no_context_id
+  def test_log_level_no_pid
     expected = [
       :emergency,
       :alert,
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20171109/cf1aaafd/attachment-0001.htm 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る