<% provide :title, 'System Log Viewer' %> <% def record_class(record) if record.level_id == 2 'warning' elsif record.level_id > 2 'danger' else record.level.to_s.downcase + '-row' end.html_safe end %>

System Log Viewer

<%= form_for @options, url: system_log_path, method: :post, html: { class: 'form-inline' } do |f| %>
Severity
<%= f.collection_select :min_severity, BarkestCore::LogEntry::SEVERITY_LIST, :to_s, :to_s, { include_blank: true}, { class: 'form-control' } %>
<%= f.date_picker_field :start_time, pre_label: 'Start Date', post_calendar: false %>
<%= f.date_picker_field :end_time, pre_label: 'End Date', post_calendar: false %>
Find
<%= f.text_field :search, class: 'form-control', placeholder: 'Any valid regex string', title: 'Remember to escape parenthesis, brackets, and literal special characters.' %>
<%= f.submit 'Refresh', class: 'btn btn-default' %> <% end %>
<% if @log.blank? %> No records found. <% else %> <%= @log.count %> record<%= @log.count > 1 ? 's' : '' %> found. <% if @log.count > @options.max_records %> Only showing the first <%= @options.max_records %>. <% end %> <% end %>
<% if @log.blank? %> <% else %> <% @log[0...@options.max_records].each do |rec| %> <% end %> <% if @log.count > @options.max_records %> <% end %> <% end %>
Severity Time App Message
No Records Found
<%= rec.level %> <%= rec.time.strftime('%Y-%m-%d %H:%M:%S') %> <%= rec.app_name %> v<%= rec.app_version %> PID:<%= rec.process_id %> <%= h(rec.message).gsub("\n", "
\n").html_safe %>
Record<%= @log.count > (@options.max_records + 1) ? 's' : '' %> <%= (@options.max_records + 1) %> <%= @log.count > (@options.max_records + 1) ? "to #{@log.count}" : '' %> not shown.