[Groonga-commit] groonga/groonga at 49cc149 [master] mrb: use CRuby like backrace report

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Mon Feb 23 11:57:18 JST 2015


Kouhei Sutou	2015-02-23 11:57:18 +0900 (Mon, 23 Feb 2015)

  New Revision: 49cc149d7f2efe00a92469625a75d344403bd7ad
  https://github.com/groonga/groonga/commit/49cc149d7f2efe00a92469625a75d344403bd7ad

  Message:
    mrb: use CRuby like backrace report

  Modified files:
    lib/mrb/scripts/logger.rb

  Modified: lib/mrb/scripts/logger.rb (+9 -8)
===================================================================
--- lib/mrb/scripts/logger.rb    2015-02-23 11:56:18 +0900 (3302135)
+++ lib/mrb/scripts/logger.rb    2015-02-23 11:57:18 +0900 (c299072)
@@ -9,12 +9,12 @@ module Groonga
         message = "#{error.class}: #{error.message}"
       end
       backtrace = error.backtrace
-      first_raw_entry = backtrace.first
-      if first_raw_entry
-        first_entry = BacktraceEntry.parse(first_raw_entry)
-        file = first_entry.file
-        line = first_entry.line
-        method = first_entry.method
+      last_raw_entry = backtrace.last
+      if last_raw_entry
+        last_entry = BacktraceEntry.parse(last_raw_entry)
+        file = last_entry.file
+        line = last_entry.line
+        method = last_entry.method
       else
         file = ""
         line = 0
@@ -22,9 +22,10 @@ module Groonga
       end
       log(log_level, file, line, method, message)
 
-      backtrace.each do |raw_entry|
+      backtrace.reverse_each.with_index do |raw_entry, i|
+        next if i == 0
         entry = BacktraceEntry.parse(raw_entry)
-        log(log_level, entry.file, entry.line, entry.method, raw_entry)
+        log(log_level, entry.file, entry.line, entry.method, entry.message)
       end
     end
   end
-------------- next part --------------
HTML����������������������������...
ダウンロード 



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