exception-track 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4e53ae1240f7be104a8b3616737f5927b3a350a27555e15b8ac9b016c9b5300
4
- data.tar.gz: 96536183c297c9c861d195f1c0720d1abf3a72ba81a9344f223930d2cb026f04
3
+ metadata.gz: d153785e412ef19575e9fa1c1c09efd6e4c6641ca6b7ef0f2874ed8c48ded09a
4
+ data.tar.gz: ec5ffb28de5d0e292edcd088156163158ace9068487759df0aaaf8e658595c90
5
5
  SHA512:
6
- metadata.gz: 861a62df66eb3e662550deb9e0a73b7e4cef0bce0b33e46008ea18477df20532ec4967b3b7c708eda73cf7dab4ed995ee4f7c82269f297288e67037eb02ea3f8
7
- data.tar.gz: 3bef483c5f518d65fb836dd2dc196ec8a649a8b58db309925778f3b1dec6ca296a4700da16b92f8ec1f60984eeef8f0c18f5b4fbd25f2868653bf16e26d7b2b2
6
+ metadata.gz: 2570f322779022af1c78361dff981300b7967c0fb4fa1710be7571945fc56431d9c54bf2a2ac9aa0a5d8d02d7e6c351ac6ced157d9dd992d43d4396da1a4cc4c
7
+ data.tar.gz: 32544198077f5147a86adafdd65f5dad1a71c82f893bb80a9ed2f2bb432f2ffd081e277cbe580ae4b10c7ab44097537a9f66021eff4368dbc721f77aa203232c
@@ -6,7 +6,7 @@ body {
6
6
  }
7
7
 
8
8
  body, textarea {
9
- font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
9
+ font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, Helvetica, sans-serif;
10
10
  font-size: 14px;
11
11
  line-height: 1.4;
12
12
  color: #333;
@@ -38,7 +38,7 @@ table {
38
38
 
39
39
  th {
40
40
  text-align: left;
41
- border-bottom: solid 1px #ddd;
41
+ border-bottom: solid 1px #e0e0e0;
42
42
  }
43
43
 
44
44
  td.date { width: 150px; font-size: 12px; }
@@ -66,9 +66,9 @@ ul {
66
66
  table td, table th {
67
67
  padding: 10px 15px;
68
68
  }
69
- th { background: #f5f5f5; border-bottom: 1px solid #eee; }
69
+ th { background: #f5f5f5; border-bottom: 1px solid #e0e0e0; }
70
70
  td {
71
- border-top: solid 1px #ddd;
71
+ border-top: solid 1px #e0e0e0;
72
72
  }
73
73
 
74
74
  pre {
@@ -108,12 +108,16 @@ hr {
108
108
  user-select: none;
109
109
  border-radius: 3px;
110
110
  border: 1px solid #ccc;
111
- padding: 8px 18px;
111
+ padding: 6px 16px;
112
+ color: #555 !important;
112
113
  outline: 0 !important;
113
114
  background: #FFF;
114
115
  }
115
- .btn:hover { text-decoration: none; }
116
- .btn-danger { background: #E25517; color: #fff; border: #D44323;}
116
+ .btn:hover { text-decoration: none !important; background: #f7f7f7; }
117
+ .btn-danger { background: #fff; color: #E33F00 !important; border-color: #E33F00;}
118
+ .btn-danger:hover {
119
+ background: #FCEDEC;
120
+ }
117
121
 
118
122
  .container {
119
123
  max-width: 1000px;
@@ -121,6 +125,8 @@ hr {
121
125
  margin-right: auto;
122
126
  padding: 20px;
123
127
  background-color: #fff;
128
+ box-shadow: 0 1px 8px rgba(200, 200, 200, 0.26);
129
+ border-radius: 3px;
124
130
  }
125
131
 
126
132
  .no-record {
@@ -134,6 +140,7 @@ hr {
134
140
  height: 34px;
135
141
  line-height: 34px;
136
142
  }
143
+ .toolbar form { display: inline; }
137
144
  .toolbar .pull-right { float: right; }
138
145
 
139
146
  #notice {
@@ -145,9 +152,9 @@ hr {
145
152
  }
146
153
 
147
154
  pre {
148
- background: #f9f9f9;
149
- padding: 10px;
150
- border: 1px solid #eee;
155
+ background: #f7f7f7;
156
+ padding: 25px;
157
+ border-radius: 3px;
151
158
  font-size: 12px;
152
159
  font-family: Menlo, Monaco, Consolas, monospace;
153
160
  }
@@ -165,6 +172,11 @@ h1 { font-size: 16px; }
165
172
  display: inline-block;
166
173
  padding: 5px 10px;
167
174
  border: 1px solid #eee;
175
+ color: #555;
176
+ text-decoration: none;
177
+ }
178
+ .pagination a:hover {
179
+ background: #f7f7f7;
168
180
  }
169
181
  .pagination em,
170
182
  .pagination .current {
@@ -10,6 +10,11 @@ module ExceptionTrack
10
10
  @logs = Log.order("id desc").page(params[:page]).per(15)
11
11
  end
12
12
 
13
+ def export
14
+ @logs = Log.order("id desc").where("created_at >= ?", 3.months.ago)
15
+ send_data JSON.pretty_generate(@logs.as_json(only: [:title, :body, :created_at, :updated_at])), filename: "#{Date.current}.json", disposition: "attachment"
16
+ end
17
+
13
18
  # GET /exception_logs/1
14
19
  def show; end
15
20
 
@@ -9,6 +9,9 @@
9
9
  <%= @logs.total_count %> exceptions
10
10
 
11
11
  <div class="pull-right">
12
+ <%= form_tag(export_logs_path, method: 'post') do %>
13
+ <button type="submit" class="btn">Export last 3 months</button>
14
+ <% end %>
12
15
  <%= form_tag(all_logs_path, method: 'delete') do %>
13
16
  <button type="submit" class="btn btn-danger" onclick="return confirmDestroyAll()">Delete All</button>
14
17
  <% end %>
@@ -4,6 +4,7 @@ ExceptionTrack::Engine.routes.draw do
4
4
  resources :logs, path: "" do
5
5
  collection do
6
6
  delete :all
7
+ post :export
7
8
  end
8
9
  end
9
10
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ExceptionTrack
4
- VERSION = "0.5.2"
4
+ VERSION = "0.6.0"
5
5
  end
@@ -38,11 +38,14 @@ module ExceptionNotifier
38
38
  def headers_for_env(env)
39
39
  return "" if env.blank?
40
40
 
41
- parameters = env["action_dispatch.request.parameters"] || {}
41
+ parameters = filter_parameters(env)
42
42
 
43
43
  headers = []
44
44
  headers << "Method: #{env['REQUEST_METHOD']}"
45
45
  headers << "URL: #{env['REQUEST_URI']}"
46
+ if env['REQUEST_METHOD'].downcase != "get"
47
+ headers << "Parameters:\n#{pretty_hash(parameters.except(:controller, :action), 13)}"
48
+ end
46
49
  headers << "Controller: #{parameters['controller']}##{parameters['action']}"
47
50
  headers << "RequestId: #{env['action_dispatch.request_id']}"
48
51
  headers << "User-Agent: #{env['HTTP_USER_AGENT']}"
@@ -53,5 +56,19 @@ module ExceptionNotifier
53
56
 
54
57
  headers.join("\n")
55
58
  end
59
+
60
+ def filter_parameters(env)
61
+ parameters = env["action_dispatch.request.parameters"] || {}
62
+ parameter_filter = ActionDispatch::Http::ParameterFilter.new(env["action_dispatch.parameter_filter"] || [])
63
+ return parameter_filter.filter(parameters)
64
+ rescue => e
65
+ Rails.logger.error "filter_parameters error: #{e.inspect}"
66
+ return parameters
67
+ end
68
+
69
+ def pretty_hash(params, indent = 0)
70
+ json = JSON.pretty_generate(params)
71
+ json.indent(indent)
72
+ end
56
73
  end
57
74
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exception-track
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-19 00:00:00.000000000 Z
11
+ date: 2019-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: exception_notification