[Exceptions] Only log commit, add quick link to user

This commit is contained in:
Earlopain 2022-07-10 19:11:32 +02:00
parent dd61b6ab5f
commit 487fd576aa
No known key found for this signature in database
GPG Key ID: 6CFB948E15246897
4 changed files with 10 additions and 13 deletions

View File

@ -10,10 +10,14 @@ class ExceptionLog < ApplicationRecord
message: exc.message,
trace: exc.backtrace.join("\n"),
code: SecureRandom.uuid,
version: "#{Danbooru.config.version} (#{Rails.application.config.x.git_hash})",
version: Rails.application.config.x.git_hash,
extra_params: params
)
log.save!
log
end
def user
User.find_by(id: extra_params["user_id"])
end
end

View File

@ -3,7 +3,7 @@
<tr>
<th style="width: 200px">Created At</th>
<th>Code</th>
<th style="width: 100px">Version</th>
<th style="width: 100px">Commit</th>
<th>Class Name</th>
<th>Message</th>
<th>Stacktrace</th>
@ -14,7 +14,7 @@
<tr style="cursor: click;">
<td><%= exception_log.created_at.strftime("%b %d, %Y %l:%M %p") %></td>
<td><%= exception_log.code %></td>
<td><%= exception_log.version %></td>
<td><%= link_to exception_log.version, Danbooru.config.commit_url(exception_log.version) %></td>
<td><%= exception_log.class_name %></td>
<td><%= exception_log.message %></td>
<td>

View File

@ -5,8 +5,9 @@
<p>
Error Code: <%= @exception_log.code %><br/>
Created At: <%= @exception_log.created_at.strftime("%b %d, %Y %l:%M %p") %><br/>
Version: <%= @exception_log.version %><br/>
IP Address: <%= link_to_ip @exception_log.ip_addr %>
Commit: <%= @exception_log.version %><br/>
IP Address: <%= link_to_ip @exception_log.ip_addr %><br/>
User: <%= link_to_user @exception_log.user %>
</p>
</div>
<strong>Extra Params:</strong>

View File

@ -69,14 +69,6 @@ module Danbooru
"#{source_code_url}/commit/#{hash}"
end
def releases_url
"#{source_code_url}/releases"
end
def issues_url
"#{source_code_url}/issues"
end
# Stripped of any special characters.
def safe_app_name
app_name.gsub(/[^a-zA-Z0-9_-]/, "_")