rails-pretty-logger 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c773a063d0b9e98e141054ba8080ea6e4021d900
4
- data.tar.gz: 49a14efc3d4d39815e049646890ded4bdc000291
3
+ metadata.gz: 23827aaf96db38b3eb70627797a5289d4c32a80a
4
+ data.tar.gz: 5cababcc32c82eeaa43b2d8c92018782ee80c135
5
5
  SHA512:
6
- metadata.gz: 9e44101d4df9c9094a798f79d71080a7921edf030cc594c814786855ddb15568992691f6b7035aa386652cb96d6a075193f2c47af61fd7e0c5f28bbc458b40cd
7
- data.tar.gz: 47794d5f96ed21bcf2e18c5153971c1dfec318411c848750afa557def86cc9b7674290f1c671a6fcf56f3bdf293fdaaa51925b1d713360720500a2cb15e451bf
6
+ metadata.gz: 9daf92873de7bd2145b2d04cdc7b429784cfb9895948a425e1b742f8a3f7b332eb6007869167b4615309f9354ad4bcf6be0f4e60cd42e68ff284c9d2b9e667a7
7
+ data.tar.gz: cd4fbee9be448304722a04d3f30dcb79b40404c2c9ef5ec9716412c941b775e8dcfcd46e95ef9f28e9b1b3074dd56e2190176088ec940c8965e318efd3618d9a
@@ -2,7 +2,11 @@ module Rails::Pretty::Logger
2
2
  module DashboardsHelper
3
3
  def check_highlight(line)
4
4
  return "<div class='highlight'>#{line.remove('[HIGHLIGHT]')}</div>".html_safe if line.include?("[HIGHLIGHT]")
5
- line
5
+ if line.include?("Parameters:")
6
+ parse_parameters(line)
7
+ else
8
+ line
9
+ end
6
10
  end
7
11
 
8
12
  def time_now
@@ -34,5 +38,13 @@ module Rails::Pretty::Logger
34
38
  def check_rails_version
35
39
  Rails::VERSION::STRING[0..2].to_f < 5.2
36
40
  end
41
+
42
+ def parse_parameters(line)
43
+ parameters = line[line.index("Parameters:") + 12 ..line.length]
44
+ hash = JSON.parse parameters.gsub('=>', ':')
45
+ h = hash.reduce("<strong> Parameters: </strong> <br/> ") {|memo, (k,v)| memo += "<strong> #{k}: </strong> #{v}, "}
46
+ h.html_safe
47
+ end
48
+
37
49
  end
38
50
  end
@@ -29,7 +29,5 @@
29
29
  <hr>
30
30
 
31
31
  <% @log_data[:paginated_logs].each do |line| %>
32
- <p>
33
- <%= check_highlight(line) %>
34
- </p>
32
+ <%= check_highlight(line) %> <br>
35
33
  <% end %>
@@ -24,9 +24,7 @@
24
24
  <hr>
25
25
 
26
26
  <% @log_data[:paginated_logs].each do |line| %>
27
- <p>
28
- <%= check_highlight(line) %>
29
- </p>
27
+ <%= check_highlight(line) %> <br>
30
28
  <% end %>
31
29
 
32
30
  <% else %>
data/config/routes.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  Rails::Pretty::Logger::Engine.routes.draw do
2
2
 
3
+ root to: "dashboards#index"
4
+
3
5
  resources :dashboards, only: [:index] do
4
6
  get :logs, on: :collection
5
7
  post :logs, on: :collection
@@ -1,7 +1,7 @@
1
1
  module Rails
2
2
  module Pretty
3
3
  module Logger
4
- VERSION = '0.2.2'
4
+ VERSION = '0.2.3'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-pretty-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cem
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-04-30 00:00:00.000000000 Z
12
+ date: 2019-05-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -59,8 +59,8 @@ dependencies:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.6'
62
- description: 'Check and search your logs from page, hightlight it to spot easily,
63
- add hourly rotation if you wish. '
62
+ description: Check and search logs from dashboard, use hightlight to spot easily,
63
+ add hourly rotation if needed.
64
64
  email:
65
65
  - cbaykam@gmail.com
66
66
  - mehmetcelik4@gmail.com