Permalink
Browse files

log messages for sinatra and rack

  • Loading branch information...
shime committed May 27, 2012
1 parent 2a06a6e commit 611e8ead7492b08ab7bd374d3b6d61030ac57909
Showing with 12 additions and 5 deletions.
  1. +2 −1 Rakefile
  2. +2 −3 lib/airbrake.rb
  3. +7 −1 lib/airbrake/configuration.rb
  4. +1 −0 lib/airbrake/rack.rb
View
@@ -124,7 +124,8 @@ LOCAL_GEMS =
['sham_rack', nil],
['capistrano', nil],
['sqlite3-ruby', nil],
- ["therubyracer",nil]
+ ["therubyracer",nil],
+ ["sinatra",nil]
]
View
@@ -18,7 +18,6 @@
require 'airbrake/railtie' if defined?(Rails::Railtie)
-# Gem for applications to automatically post errors to the Airbrake of their choice.
module Airbrake
API_VERSION = "2.2"
LOG_PREFIX = "** [Airbrake] "
@@ -55,8 +54,8 @@ def report_response_body(response)
# Returns the Ruby version, Rails version, and current Rails environment
def environment_info
info = "[Ruby: #{RUBY_VERSION}]"
- info << " [#{configuration.framework}]"
- info << " [Env: #{configuration.environment_name}]"
+ info << " [#{configuration.framework}]" if configuration.framework
+ info << " [Env: #{configuration.environment_name}]" if configuration.environment_name
end
# Writes out the given message to the #logger
@@ -228,6 +228,9 @@ def port
@port || default_port
end
+ # Determines whether protocol should be "http" or "https".
+ # @return [String] Returns +"http"+ if you've set secure to +false+ in
+ # configuration, and +"https"+ otherwise.
def protocol
if secure?
'https'
@@ -248,7 +251,7 @@ def environment_filters
warn 'config.environment_filters has been deprecated and has no effect.'
[]
end
-
+
def ca_bundle_path
if use_system_ssl_cert_chain? && File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)
OpenSSL::X509::DEFAULT_CERT_FILE
@@ -262,6 +265,9 @@ def local_cert_path
end
private
+ # Determines what port should we use for sending notices.
+ # @return [Fixnum] Returns 443 if you've set secure to true in your
+ # configuration, and 80 otherwise.
def default_port
if secure?
443
View
@@ -22,6 +22,7 @@ module Airbrake
class Rack
def initialize(app)
@app = app
+ Airbrake.configuration.logger ||= Logger.new STDOUT
end
def call(env)

0 comments on commit 611e8ea

Please sign in to comment.