Kouhei Sutou
null+****@clear*****
Mon May 18 11:58:05 JST 2015
Kouhei Sutou 2015-05-18 11:58:05 +0900 (Mon, 18 May 2015) New Revision: 1a105ffe47f49533538567a0dc33b38caf3fc777 https://github.com/ranguba/rroonga/commit/1a105ffe47f49533538567a0dc33b38caf3fc777 Message: Add Groonga::QueryLogger.log(message, :flags => ...) Modified files: ext/groonga/rb-grn-query-logger.c test/test-query-logger.rb Modified: ext/groonga/rb-grn-query-logger.c (+1 -1) =================================================================== --- ext/groonga/rb-grn-query-logger.c 2015-05-14 19:18:19 +0900 (24ce6fa) +++ ext/groonga/rb-grn-query-logger.c 2015-05-18 11:58:05 +0900 (cc183b4) @@ -100,7 +100,7 @@ rb_grn_query_logger_s_log (int argc, VALUE *argv, VALUE klass) if (!NIL_P(rb_flags)) { flags = rb_funcall(mGrnQueryLoggerFlags, id_parse, 2, - UINT2NUM(flags), rb_flags); + rb_flags, UINT2NUM(flags)); } if (!NIL_P(rb_mark)) { mark = StringValueCStr(rb_mark); Modified: test/test-query-logger.rb (+20 -0) =================================================================== --- test/test-query-logger.rb 2015-05-14 19:18:19 +0900 (11aac63) +++ test/test-query-logger.rb 2015-05-18 11:58:05 +0900 (0868b0a) @@ -97,6 +97,26 @@ class QueryLoggerTest < Test::Unit::TestCase messages) end + test ":flags" do + infos = [] + Groonga::QueryLogger.register do |action, flag, timestamp, info, message| + infos << info + end + Groonga::QueryLogger.log("default") + Groonga::QueryLogger.log("flags", :flags => "command") + normalized_infos = infos.collect do |info| + info = info.gsub(/\A0x[a-f\d]+\|/, + "context_id|") + info.gsub(/\|[\d]+ \z/, + "|timestamp ") + end + assert_equal([ + "context_id|timestamp ", + "context_id|", + ], + normalized_infos) + end + test ":mark" do infos = [] Groonga::QueryLogger.register do |action, flag, timestamp, info, message| -------------- next part -------------- HTML����������������������������...Download