Class: CloudLogger::Papertrail
Instance Method Summary collapse
-
#initialize(options) ⇒ Papertrail
constructor
A new instance of Papertrail.
- #log(message) ⇒ Object
- #search(query) {|result| ... } ⇒ Object
Constructor Details
#initialize(options) ⇒ Papertrail
Returns a new instance of Papertrail.
5 6 7 8 |
# File 'lib/papertrail.rb', line 5 def initialize() @user = [:user] @pass = [:pass] end |
Instance Method Details
#log(message) ⇒ Object
10 11 12 |
# File 'lib/papertrail.rb', line 10 def log() raise "sending logs is not supported for the Papertrail driver" end |
#search(query) {|result| ... } ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/papertrail.rb', line 14 def search(query) raw_response = RestClient.get("https://#{@user}:#{@pass}@papertrailapp.com/api/vi/events/search.json", {:params => {:q => query}}) result = JSON.parse(raw_response)['events'].map do |log_entry| CloudLogger::Event.new(log_entry['message'], log_entry['received_at']) end yield result if block_given? result end |