[Groonga-commit] groonga/groonga-query-log at 433abd5 [master] Add Parser#current_path

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jan 15 16:09:20 JST 2018


Kouhei Sutou	2018-01-15 16:09:20 +0900 (Mon, 15 Jan 2018)

  New Revision: 433abd5e84695efadf3784a5eda359d8c8d0f4a4
  https://github.com/groonga/groonga-query-log/commit/433abd5e84695efadf3784a5eda359d8c8d0f4a4

  Message:
    Add Parser#current_path

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

  Modified: lib/groonga-query-log/parser.rb (+9 -1)
===================================================================
--- lib/groonga-query-log/parser.rb    2018-01-15 15:24:57 +0900 (5db5e35)
+++ lib/groonga-query-log/parser.rb    2018-01-15 16:09:20 +0900 (ff22b06)
@@ -36,6 +36,7 @@ module GroongaQueryLog
       end
     end
 
+    attr_reader :current_path
     def initialize(options={})
       @options = options
       @slow_operation_threshold = options[:slow_operation_threshold]
@@ -43,6 +44,8 @@ module GroongaQueryLog
       @target_commands = options[:target_commands]
       @target_tables = options[:target_tables]
       @parsing_statistics = {}
+
+      @current_path = nil
     end
 
     # Parses query-log file as stream to
@@ -90,7 +93,12 @@ module GroongaQueryLog
       target_paths = GroongaLog::Parser.sort_paths(paths)
       target_paths.each do |path|
         GroongaLog::Input.open(path) do |log|
-          parse(log, &block)
+          @current_path = path
+          begin
+            parse(log, &block)
+          ensure
+            @current_path = nil
+          end
         end
       end
     end
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180115/9f7f9614/attachment.htm 



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