Skip to content

Commit

Permalink
Merge pull request #332 from smartinez87/fix_timestamp
Browse files Browse the repository at this point in the history
Fix timestamp error
  • Loading branch information
smartinez87 committed Jun 13, 2016
2 parents 5c2529e + 9bd8ad3 commit eaa70f4
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions lib/exception_notifier/email_notifier.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "active_support/core_ext/hash/reverse_merge"
require 'active_support/core_ext/time'
require 'action_mailer'
require 'action_dispatch'
require 'pp'
Expand Down Expand Up @@ -33,6 +34,7 @@ def exception_notification(env, exception, options={}, default_options={})
@kontroller = env['action_controller.instance'] || MissingController.new
@request = ActionDispatch::Request.new(env)
@backtrace = exception.backtrace ? clean_backtrace(exception) : []
@timestamp = Time.current
@sections = @options[:sections]
@data = (env['exception_notifier.exception_data'] || {}).merge(options[:data] || {})
@sections = @sections + %w(data) unless @data.empty?
Expand All @@ -46,6 +48,7 @@ def background_exception_notification(exception, options={}, default_options={})
@exception = exception
@options = options.reverse_merge(default_options)
@backtrace = exception.backtrace || []
@timestamp = Time.current
@sections = @options[:background_sections]
@data = options[:data] || {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</li>
<li>
<strong>Timestamp:</strong>
<span><%= Time.current %></span>
<span><%= @timestamp %></span>
</li>
<li>
<strong>Server:</strong>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* HTTP Method: <%= raw @request.request_method %>
* IP address : <%= raw @request.remote_ip %>
* Parameters : <%= raw safe_encode @request.filtered_parameters.inspect %>
* Timestamp : <%= raw Time.current %>
* Timestamp : <%= raw @timestamp %>
* Server : <%= raw Socket.gethostname %>
<% if defined?(Rails) && Rails.respond_to?(:root) %>
* Rails root : <%= raw Rails.root %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<tr>
<td style="padding: 10px; border: 1px solid #eed3d7; background-color: #f2dede">
<h3 style="color: #b94a48">
<%= @exception.class.to_s =~ /^[aeiou]/i ? 'An' : 'A' %> <%= @exception.class %> occurred in background at <%= Time.current %> :
<%= @exception.class.to_s =~ /^[aeiou]/i ? 'An' : 'A' %> <%= @exception.class %> occurred in background at <%= @timestamp %> :
</h3>
<p style="color: #b94a48"><%= @exception.message %></p>
<pre style="font-size: 12px; padding: 5px; background-color:#f5f5f5">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= @exception.class.to_s =~ /^[aeiou]/i ? 'An' : 'A' %> <%= @exception.class %> occurred in background at <%= raw Time.current %> :
<%= @exception.class.to_s =~ /^[aeiou]/i ? 'An' : 'A' %> <%= @exception.class %> occurred in background at <%= raw @timestamp %> :

<%= @exception.message %>
<%= @backtrace.first %>
Expand Down
1 change: 1 addition & 0 deletions lib/exception_notifier/webhook_notifier.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'action_dispatch'
require 'active_support/core_ext/time'

module ExceptionNotifier
class WebhookNotifier < BaseNotifier
Expand Down

0 comments on commit eaa70f4

Please sign in to comment.