Sha256: efd9eb22a33f8dd1de6d8b1ea23802fd577687df1962ec23206b5db3d2b2c978

Contents?: true

Size: 971 Bytes

Versions: 30

Compression:

Stored size: 971 Bytes

Contents

module Groonga
  class Logger
    def log_error(error)
      log_level = Level::ERROR.to_i

      if error.is_a?(Error)
        message = error.message
      else
        message = "#{error.class}: #{error.message}"
      end
      backtrace = error.backtrace
      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
        # message = "#{file}:#{line}:#{method}: #{message}"
      else
        file = ""
        line = 0
        method = ""
      end
      log(log_level, file, line, method, message)

      backtrace.reverse_each.with_index do |raw_entry, i|
        next if i == 0
        entry = BacktraceEntry.parse(raw_entry)
        message = entry.message
        message = raw_entry if message.empty?
        log(log_level, entry.file, entry.line, entry.method, raw_entry)
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rroonga-6.1.3-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-6.1.3-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-6.1.0-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-6.1.0-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-6.0.9-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-6.0.9-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-6.0.7-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-6.0.7-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-6.0.5-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-6.0.5-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-6.0.4-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-6.0.4-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-6.0.2-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-6.0.2-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-6.0.0-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-6.0.0-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-5.0.9-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-5.0.9-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-5.0.8-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb
rroonga-5.0.8-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/logger.rb