log_analyzer 0.2.0 → 0.2.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +7 -1
- data/lib/log_analyzer/analyzer.rb +8 -5
- data/lib/log_analyzer/configuration.rb +7 -12
- data/lib/log_analyzer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4db64b0570b5c4460fe690d93e3b76e1863a1e7
|
4
|
+
data.tar.gz: a23f1ffeb8204b95450ee89727a4be33b38676bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08e24d953918afdd034d80cd2081c196f963239596c87e038fd1ee7b4d16acfaa3b434dde217f64cf7e877e1a7646fc33a0e31d00311726058c8477564657a0b'
|
7
|
+
data.tar.gz: ab6fc1ab6b6d1edcb22d05ed02641139064eb4929c61775d5499561873a2c7679893adead6276528ae782f12a14df1ff9cb9fb776183bb219c46105021e2b646
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
[](https://travis-ci.org/igorkasyanchuk/log_analyzer)
|
2
|
+
|
1
3
|
# LogAnalyzer
|
2
4
|
|
3
5
|
See how fast is rendering in your Ruby on Rails app. Based on information from logs. Provides you a picture of how often renders and how fast renders your views.
|
4
6
|
|
5
7
|
## Sample
|
6
8
|
|
7
|
-
[](https://raw.githubusercontent.com/igorkasyanchuk/log_analyzer/master/docs/screenshot.png)
|
8
10
|
|
9
11
|
You can see columns:
|
10
12
|
|
@@ -66,6 +68,10 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/varyfo
|
|
66
68
|
|
67
69
|
* more analytics
|
68
70
|
* more specs
|
71
|
+
* export to PDF
|
72
|
+
* export to CSV
|
73
|
+
* export to XLS
|
74
|
+
* export to HTML/CSS/JS with datatable.js
|
69
75
|
|
70
76
|
## License
|
71
77
|
|
@@ -2,13 +2,13 @@ module LogAnalyzer
|
|
2
2
|
|
3
3
|
class Analyzer
|
4
4
|
DEFAULT_TABLE_WIDTH = 120 # width
|
5
|
-
MATCHER = /Rendered (.*\/.*) \((.*)ms\)/.freeze
|
6
5
|
DANGER_DEFAULT = 800 # ms
|
7
6
|
WARNING_DEFAULT = 400 # ms
|
8
7
|
INFO_DEFAULT = 100 # ms
|
9
8
|
HEADER = ['Type', 'View', 'Count', 'AVG (ms)', 'Max', 'Min'].freeze
|
10
9
|
PARTIAL_LABEL = " P ".on_green.black.freeze
|
11
10
|
VIEW_LABEL = " V ".on_yellow.black.freeze
|
11
|
+
MATCHER = /Rendered (.*\/.*) \((.*)ms\)/.freeze
|
12
12
|
|
13
13
|
attr_reader :filename
|
14
14
|
attr_reader :stats
|
@@ -28,10 +28,9 @@ module LogAnalyzer
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
view.split('/'.freeze).last[0] == '_' ? 'P'.freeze : 'V'.freeze
|
31
|
+
rescue Errno::ENOENT
|
32
|
+
puts "File <#{filename}> not found or not accessible.".red
|
33
|
+
exit
|
35
34
|
end
|
36
35
|
|
37
36
|
def order(by: :time)
|
@@ -70,6 +69,10 @@ module LogAnalyzer
|
|
70
69
|
|
71
70
|
private
|
72
71
|
|
72
|
+
def find_type(view)
|
73
|
+
view.split('/'.freeze).last[0] == '_'.freeze ? 'P'.freeze : 'V'.freeze
|
74
|
+
end
|
75
|
+
|
73
76
|
def type_label(type)
|
74
77
|
type == LogAnalyzer::Configuration::PARTIALS ? PARTIAL_LABEL : VIEW_LABEL
|
75
78
|
end
|
@@ -4,19 +4,25 @@ module LogAnalyzer
|
|
4
4
|
ALL = 'A'.freeze # ALL
|
5
5
|
PARTIALS = 'P'.freeze # Partials
|
6
6
|
VIEWS = 'V'.freeze # Views
|
7
|
+
FILTERS = Hash.new([PARTIALS, VIEWS]).merge({
|
8
|
+
PARTIALS => [PARTIALS],
|
9
|
+
VIEWS => [VIEWS]
|
10
|
+
}).freeze # with default value ALL
|
7
11
|
|
8
12
|
class << self
|
9
13
|
attr_accessor :configuration
|
10
14
|
end
|
11
15
|
|
12
16
|
attr_accessor :filter
|
17
|
+
attr_reader :filters
|
13
18
|
|
14
19
|
def initialize
|
15
20
|
@filter = ALL
|
16
21
|
end
|
17
22
|
|
18
23
|
def filter=(other)
|
19
|
-
@filter
|
24
|
+
@filter = other.upcase[0]
|
25
|
+
@filters ||= FILTERS[filter]
|
20
26
|
end
|
21
27
|
|
22
28
|
def self.configuration
|
@@ -31,17 +37,6 @@ module LogAnalyzer
|
|
31
37
|
yield(configuration)
|
32
38
|
end
|
33
39
|
|
34
|
-
def filters
|
35
|
-
@filters ||= case filter
|
36
|
-
when VIEWS
|
37
|
-
[VIEWS]
|
38
|
-
when PARTIALS
|
39
|
-
[PARTIALS]
|
40
|
-
else
|
41
|
-
[PARTIALS, VIEWS]
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
40
|
end
|
46
41
|
|
47
42
|
end
|
data/lib/log_analyzer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log_analyzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Kasyanchuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|