Sha256: 113aedd7f2a0fdf44f9d15468a6558e5fbc8c402fe05a637e04fb17d48e909e0
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
module RSqoot module Logger # Add logger support, easy for log monitor when running your app # Output errors and valid records count # TODO add color support # def logger(options = {records: [], uri: '', error: '', type: '', opts: {}}) records = options[:records].nil? ? [] : options[:records] error = options[:error] uri = options[:uri] type = options[:type] opts = options[:opts] if defined? Rails if error.present? Rails.logger.info ">>> Error: #{error}" else Rails.logger.info ">>> Querying Sqoot API V2: #{type}" Rails.logger.info ">>> #{uri}" Rails.logger.info ">>> #{opts}" Rails.logger.info ">>> Hit #{records.count} records" end else if error.present? puts ">>> Error: #{error}" puts "" else puts ">>> Querying Sqoot API V2: #{type}" puts "" puts ">>> #{uri}" puts "" puts ">>> #{opts}" puts "" puts ">>> Hit #{records.count} records" puts "" end end end module_function :logger end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rsqoot-0.5.5 | lib/rsqoot/logger.rb |