Class: ErrorStalker::Server
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- ErrorStalker::Server
- Defined in:
- lib/error_stalker/server.rb
Overview
The ErrorStalker server. Provides a UI for browsing, grouping, and searching exception reports, as well as a centralized store for keeping exception reports. As a Sinatra app, this can be run using a config.ru file or something like Vegas. A sample Vegas runner for the server is located in bin/error_stalker_server
.
Constant Summary collapse
- PER_PAGE =
The number of exceptions or exception groups to show on each page.
25
Class Attribute Summary collapse
-
.configuration ⇒ Object
A hash of configuration options, usually read from a configuration file.
Instance Attribute Summary collapse
-
#plugins ⇒ Object
A list of plugins the server will use.
-
#store ⇒ Object
The data store (ErrorStalker::Store instance) to use to store exception data.
Class Method Summary collapse
-
.store ⇒ Object
The default ErrorStalker::Store subclass to use by default for this ErrorStalker::Server instance.
Instance Method Summary collapse
-
#configuration ⇒ Object
A hash of configuration options, usually read from a configuration file.
-
#initialize ⇒ Server
constructor
Creates a new instance of the server, based on the configuration contained in the
configuration
attribute.
Constructor Details
#initialize ⇒ Server
Creates a new instance of the server, based on the configuration contained in the configuration
attribute.
91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/error_stalker/server.rb', line 91 def initialize super self.plugins = [] if configuration['plugin'] configuration['plugin'].each do |config| plugin_class = config['class'].split('::').inject(Object) {|mod, string| mod.const_get(string)} self.plugins << plugin_class.new(self, config['parameters']) end end self.store = self.class.store end |
Class Attribute Details
.configuration ⇒ Object
A hash of configuration options, usually read from a configuration file.
65 66 67 |
# File 'lib/error_stalker/server.rb', line 65 def configuration @configuration end |
Instance Attribute Details
#plugins ⇒ Object
A list of plugins the server will use.
30 31 32 |
# File 'lib/error_stalker/server.rb', line 30 def plugins @plugins end |
#store ⇒ Object
The data store (ErrorStalker::Store instance) to use to store exception data
27 28 29 |
# File 'lib/error_stalker/server.rb', line 27 def store @store end |
Class Method Details
.store ⇒ Object
The default ErrorStalker::Store subclass to use by default for this ErrorStalker::Server instance. This is defined as a class method as well as an instance method so that it can be set by a configuration file before rack creates the instance of this sinatra app.
74 75 76 77 78 79 80 81 |
# File 'lib/error_stalker/server.rb', line 74 def self.store if configuration['store'] store_class = configuration['store']['class'].split('::').inject(Object) {|mod, string| mod.const_get(string)} store_class.new(*Array(configuration['store']['parameters'])) else ErrorStalker::Store::InMemory.new end end |
Instance Method Details
#configuration ⇒ Object
A hash of configuration options, usually read from a configuration file.
85 86 87 |
# File 'lib/error_stalker/server.rb', line 85 def configuration self.class.configuration end |