Methods
C
L
Classes and Modules
Attributes
[RW] default_options

Default options to be used for Apphunk.log. Initialized by Apphunk::Config.

Class Public methods
config(&block)

Set runtime configuration options

Yields Apphunk::Config which can be used to set configuration options in one place. See Apphunk::Config for a list of available options. These options will be available in Apphunk.default_options.

Examples

 Apphunk.config do |config|
   config.token = "secret_project_token"
   config.environments = %w(staging production)
 end
# File lib/apphunk.rb, line 68
    def config(&block)
      yield Apphunk::Config
      self.default_options[:tags] = Apphunk::Config.tags
      self.default_options[:token] = Apphunk::Config.token
      self.default_options[:trails] = Apphunk::Config.trails
      self.default_options[:environments] = Apphunk::Config.environments
      
      if Apphunk::Config.environment.blank?
        Apphunk::Config.environment = self.default_options[:environment]
      else
        self.default_options[:environment] = Apphunk::Config.environment 
      end
    end
log(message, options = {})

Sends a message to your remote inbox at apphunk.com

For a list of available options see Apphunk::Config.

Examples

 Apphunk.log("Yet another hello world")
 Apphunk.log("Tag me baby", :tags => 'apphunk, doc, examples', :trails => { :user_id => 5 })
 Apphunk.log("I'm on my way to a different project", :token => 'secret_project_access_token')
# File lib/apphunk.rb, line 28
    def log(message, options = {})
      options = (self.default_options || {}).merge(options)
      Apphunk::Proxy.send_message_to_apphunkd(message, options)
    end
log_with_options(options = {}, &block)

Send messages with predefined options in a block

Yields the Apphunk module which can be used to send messages via Apphunk.log, but temporarily merges the provided options with Apphunk.default_options. Can be used to send a bunch of messages with the same options.

For a list of available options see Apphunk::Config.

Examples

 Apphunk.log_with_options(:tags => 'hello world') do |apphunk|
   apphunk.log("A messages with tags")
   apphunk.log("Another messages with the same tags")
 end
# File lib/apphunk.rb, line 49
    def log_with_options(options = {}, &block)
      preserved_defaults = self.default_options
      self.default_options = (self.default_options || {}).merge(options)
      yield self
      self.default_options = preserved_defaults
    end