Logster update
cleans up a bunch of messed up context stuff with multisite improves backtraces adds request params
This commit is contained in:
parent
4de0351aea
commit
7fbf162666
|
@ -152,7 +152,7 @@ GEM
|
|||
thor (~> 0.15)
|
||||
libv8 (3.16.14.3)
|
||||
listen (0.7.3)
|
||||
logster (0.0.9)
|
||||
logster (0.0.10)
|
||||
lru_redux (0.8.1)
|
||||
mail (2.5.4)
|
||||
mime-types (~> 1.16)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class ForumsController < ApplicationController
|
||||
|
||||
skip_before_filter :check_xhr, only: [:status]
|
||||
skip_before_filter :check_xhr
|
||||
skip_before_filter :authorize_mini_profiler, only: [:status]
|
||||
skip_before_filter :redirect_to_login_if_required, only: [:status]
|
||||
|
||||
|
|
|
@ -11,10 +11,9 @@
|
|||
})();
|
||||
</script>
|
||||
|
||||
<% if Rails.env.development? %>
|
||||
<script>
|
||||
// Don't swallow promises in development mode. Let's fix those.
|
||||
<script>
|
||||
Ember.RSVP.configure('onerror', function(e) {
|
||||
<% if Rails.env.development? %>
|
||||
if (e) {
|
||||
if (e.message || e.stack) {
|
||||
console.log(e.message);
|
||||
|
@ -25,9 +24,10 @@
|
|||
} else {
|
||||
console.log("A promise failed but was not caught.");
|
||||
}
|
||||
<% end %>
|
||||
window.onerror(e && e.message, null,null,null,e);
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
Discourse.CDN = '<%= Rails.configuration.action_controller.asset_host %>';
|
||||
|
|
|
@ -3,4 +3,25 @@ if Rails.env.production?
|
|||
Logster.store.ignore = [
|
||||
/^ActionController::RoutingError \(No route matches/
|
||||
]
|
||||
|
||||
Logster.config.authorize_callback = lambda{|env|
|
||||
user = CurrentUser.lookup_from_env(env)
|
||||
user && user.admin
|
||||
}
|
||||
end
|
||||
|
||||
# middleware that logs errors sits before multisite
|
||||
# we need to establish a connection so redis connection is good
|
||||
# and db connection is good
|
||||
Logster.config.current_context = lambda{|env,&blk|
|
||||
begin
|
||||
if Rails.configuration.multisite
|
||||
request = Rack::Request.new(env)
|
||||
ActiveRecord::Base.connection_handler.clear_active_connections!
|
||||
RailsMultisite::ConnectionManagement.establish_connection(:host => request['__ws'] || request.host)
|
||||
end
|
||||
blk.call
|
||||
ensure
|
||||
ActiveRecord::Base.connection_handler.clear_active_connections!
|
||||
end
|
||||
}
|
||||
|
|
|
@ -14,11 +14,12 @@ Discourse::Application.routes.draw do
|
|||
match "/404", to: "exceptions#not_found", via: [:get, :post]
|
||||
get "/404-body" => "exceptions#not_found_body"
|
||||
|
||||
if Rails.env == "development"
|
||||
mount Sidekiq::Web => "/sidekiq"
|
||||
mount Logster::Web => "/logs"
|
||||
else
|
||||
mount Sidekiq::Web => "/sidekiq", constraints: AdminConstraint.new
|
||||
|
||||
if Rails.env.production?
|
||||
require 'logster/middleware/viewer'
|
||||
mount Logster::Middleware::Viewer.new(nil) => "/logs", constraints: AdminConstraint.new
|
||||
mount Logster::Web => "/logs", constraints: AdminConstraint.new
|
||||
end
|
||||
|
||||
get "site" => "site#index"
|
||||
|
|
|
@ -5,7 +5,9 @@ module RailsMultisite
|
|||
end
|
||||
|
||||
initializer "RailsMultisite.init" do |app|
|
||||
Rails.configuration.multisite = false
|
||||
if File.exists?(ConnectionManagement.config_filename)
|
||||
Rails.configuration.multisite = true
|
||||
ConnectionManagement.load_settings!
|
||||
app.middleware.insert_after(ActiveRecord::ConnectionAdapters::ConnectionManagement, RailsMultisite::ConnectionManagement)
|
||||
app.middleware.delete(ActiveRecord::ConnectionAdapters::ConnectionManagement)
|
||||
|
|
Loading…
Reference in New Issue