whoops 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,107 +5,12 @@ Daniel Higginbotham <daniel@flyingmachinestudios.com>
5
5
 
6
6
  == What is Whoops?
7
7
 
8
- Whoops is a logging system. It consists of a Rails engine (which records logs and provides an interface to them) and a logger. Both are described below, along with how they compare to Hoptoad. Note that the comparisons aren't meant to disparage Hoptoad - it's a great product. They're only meant to help describe Whoops and help people decide whether it would be useful to them.
9
-
10
- == Whoops Server
11
-
12
- The Whoops server is a Rails engine which records logs and provides an interface to filter, search, and view them. Below is a listing of its features and how it compares to Hoptoad:
13
-
14
- === Log Arbitrary Events
15
-
16
- With Hoptoad, you only log exceptions. With Whoops, it's up to you to tell the Whoops server what you're logging, be it an exception, notification, warning, or whatever. Internally, Whoops EventGroups use the event_type field to store the event type. You can filter on this field when viewing a listing of all events.
17
-
18
- image::https://github.com/flyingmachine/whoops/raw/master/doc/images/dash-filters.png[Filters]
19
-
20
- === Log Arbitrary Details
21
-
22
- With Hoptoad, the fields which you can log are pre-defined. They also reflect an assumption that your error happened within the context of handling an HTTP request. Whoops uses mongodb as its database and this allows you to log whatever details you want. For example, you could log the following:
23
-
24
- ----
25
- {
26
- :start_time => 1310748754,
27
- :end_time => 1310949834,
28
- :users_imported => [
29
- { :id => 413, :succeeded => false },
30
- { :id => 835, :succeeded => true },
31
- { :id => 894, :succeeded => true },
32
- { :id => 124, :succeeded => true },
33
- ],
34
- }
35
- ----
36
-
37
- This gets stored as-is in Whoops. You can also search these details, as explained below:
38
-
39
- === Search Event Details
40
-
41
- As far I know, you can't search Hoptoad. Whoops let's you search all Events within an EventGroup. Eventually, keyword search over all events will be implemented.
42
-
43
- Below is example text you would write, and below that is essentially the ruby code that ends up getting run by the server.
44
-
45
- ----
46
- details.current_user_id#in [3, 54, 532] <1>
47
- details.num_failures#gt 3 <2>
48
- details.current_user.first_name Voldemort <3>
49
- message#in !r/(yesterday|today)/ <4>
50
- ----
51
-
52
- <1> `Event.where( {:"details.current_user_id".in => [3, 54, 532]} )`
53
- <2> `Event.where( {:"details.num_failure".gt => 3} )`
54
- <3> `Event.where( {:"details.current_user.first_name" => "Voldemort"} )`
55
- <4> `Event.where( {:message.in /(yesterday|today/)} )` Note that regular expressions must start with !r.
56
-
57
- The general format is +key[#mongoid_method] query+ . As you can see, +query+ can be a string, number, regex, or array of these values. Hashes are allowed too. If you're not familiar with querying mongo, you can http://www.mongodb.org/display/DOCS/Querying[read more in the mongodb docs]. The http://mongoid.org/docs/querying/criteria.html#where[Mongoid] docs are useful as well.
58
-
59
- === Extend the App
60
-
61
- Since Whoops is a Rails engine, you can make changes to your base rails app without worrying about merge difficulties when you upgrade Whoops.
62
-
63
- === No Users or Projects
64
-
65
- In Hoptoad, errors are assigned to projects, and access to projects is given to users. In Whoops, there are no users, so it's not necessary to manage access rights or even to log in. Additionally, there is no Project model within the code or database. Instead, each EventGroup has a +service+ field which you can filter on. Services can be namespaced, so that if you have the services "godzilla.web" and "godzilla.background", you can set a filter to show events related to either service or to their common name, "godzilla".
66
-
67
- Note that you can add users and/or login to the base rails app if you really want to.
68
-
69
- === Notifications
70
-
71
- Since Whoops doesn't have users, email notification of events is handled by entering an email address along with a newline-separated list of services to receive notifications for. This isn't 100% implemented yet.
72
-
73
- === You Manage the Rails App
74
-
75
- If you use Whoops you'll have to manage the Rails app yourself. You'll have to set up mongodb and all that. Heroku has a http://addons.heroku.com/mongolab[great mongodb addon] that gives you 240mb of space for free. Hoptoad doesn't require you to host or manage anything.
76
-
77
- == Demos
78
-
79
- * http://whoops-example.heroku.com[Example of the Whoops Rails engine]
80
- * http://whoops-rails-notifier-example.heroku.com/[Example site which sends logs to whoops]
81
-
82
- == Usage
83
-
84
- === Installation
85
-
86
- . create a new rails app
87
- . add +gem "whoops"+ to your Gemfile
88
- . run +bundle+
89
- . add http://mongoid.org/docs/installation/configuration.html[+config/mongoid.yml+]
90
- . run +bundle exec rails g whoops:assets+ - this copies assets to your public directory (whoops isn't 3.1 compatible yet)
91
- . _optional_ add `root :to => "event_groups#index"` to your routes file to make the event group listing your home page
92
- . add https://github.com/flyingmachine/whoops_logger[loggers] to the code you want to monitor
93
-
94
- === Filtering
95
-
96
- .Filters
97
- image::https://github.com/flyingmachine/whoops/raw/master/doc/images/dash-filters.png[Filters]
98
-
99
- When viewing the Event Group list, you can filter by service, environment, and event type.
100
-
101
- When you set a filter, its value is stored in a session and won't be changed until you click "reset". This is so that you won't lose your filter after, for example, viewing a specific event.
8
+ Whoops is a logging system. It consists of a Rails engine (which records logs and provides an interface to them) and a logger. Full documentation can be found at http://www.whoopsapp.com[the Whoops web site].
102
9
 
103
10
  == TODO
104
11
 
105
12
  * finish email notification of events
106
- * site-wide search
107
13
  * graphing
108
- * logger documentation
109
14
 
110
15
  == Alternatives
111
16
 
@@ -7,7 +7,7 @@ class EventGroupsController < ApplicationController
7
7
  finder = if params[:query].blank?
8
8
  Whoops::EventGroup.where(event_group_filter.to_query_document)
9
9
  else
10
- Whoops::EventGroup.where(:_id.in => Whoops::Event.where(:keywords => /#{params[:query]}/).collect{|e| e.event_group_id}.uniq)
10
+ Whoops::EventGroup.where(:_id.in => Whoops::Event.where(:keywords => /#{params[:query]}/i).collect{|e| e.event_group_id}.uniq)
11
11
  end
12
12
 
13
13
  @event_groups = finder.desc(:last_recorded_at).paginate(
@@ -11,7 +11,7 @@
11
11
  - @event_groups.each do |event_group|
12
12
  %tr
13
13
  %td= event_group_scoped_link(event_group, :service)
14
- %td= link_to event_group.message, whoops_event_group_events_path(event_group)
14
+ %td= link_to event_group.message.truncate(50), whoops_event_group_events_path(event_group)
15
15
  %td= event_group_scoped_link(event_group, :event_type)
16
16
  %td= event_group_scoped_link(event_group, :environment)
17
17
  %td= event_group.last_recorded_at.to_s(:whoops_default)
@@ -38,5 +38,4 @@
38
38
  - if @events.empty?
39
39
  %p Your search returned no results.
40
40
  - else
41
- = render :partial => "events/details", :object => @events.first, :as => :event
42
-
41
+ = render :partial => "events/details", :object => @events.first, :as => :event
@@ -971,4 +971,8 @@ font-size: 14px;}
971
971
  a {
972
972
  text-decoration:underline;
973
973
  }
974
+ }
975
+
976
+ #event-details {
977
+ overflow-x:auto;
974
978
  }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whoops
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Higginbotham
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-23 00:00:00 -04:00
18
+ date: 2011-07-27 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency