log_analyzer 0.3.1 → 0.3.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
- SHA1:
3
- metadata.gz: 3949a52059cfee648c1748f24c7568a188c3b7ae
4
- data.tar.gz: c0bc7095f2140417b1e61ff35421eed7c2c378d0
2
+ SHA256:
3
+ metadata.gz: fb38bc538db35eb6cc492e246ff6f91789dbcfc36c10f280ce98ae3c3ace1a1b
4
+ data.tar.gz: 66d394742f76c8e31d8e4625cf4c4fdb5152f1539d606674aec5e8680a14f6f1
5
5
  SHA512:
6
- metadata.gz: 02afd22979e2959f38520ef65a03cca3f46e26ccc3317d32bca99e591acab8efc9d23ca28ab02ce6cc09a119c759a90e4dce0d7a8df595cd94e75510926371ce
7
- data.tar.gz: ee999e789c0cc89ee027f2c7a81e8ccb8d6419a16ccaaffe43c453bb23a9a5239d8a87bb9a2425a0482b7564bbe45f7bd91f6d2aaccb1f665208e507f8e00f54
6
+ metadata.gz: f7a4e275c9758308f1e8a37c1a418680ebb949972f170a548003801934b107f649d318d9fe6a7b8b7562d3f6b6742748856e8e0f94037f68782feba51893a0f0
7
+ data.tar.gz: 12bef142bab0e3a0b2154b6efacf9b449474286b823ba3e0c7db0d94c4df5370f3934c18dae52ee94e4fdd6c67af4cb2f4432df60f099ff25d48eb8962174ce9
data/Gemfile CHANGED
@@ -4,4 +4,5 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'simplecov', require: false, group: :test
7
- gem 'rspec'
7
+ gem 'rspec'
8
+ gem 'spreadsheet'
data/Gemfile.lock CHANGED
@@ -1,11 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- log_analyzer (0.3.1)
4
+ log_analyzer (0.3.3)
5
5
  colorize
6
6
  prawn
7
7
  prawn-table
8
8
  rake
9
+ spreadsheet
9
10
  terminal-table
10
11
  thor
11
12
 
@@ -18,16 +19,16 @@ GEM
18
19
  docile (1.1.5)
19
20
  json (2.0.3)
20
21
  method_source (0.9.0)
21
- pdf-core (0.7.0)
22
- prawn (2.2.2)
23
- pdf-core (~> 0.7.0)
24
- ttfunk (~> 1.5)
22
+ pdf-core (0.9.0)
23
+ prawn (2.4.0)
24
+ pdf-core (~> 0.9.0)
25
+ ttfunk (~> 1.7)
25
26
  prawn-table (0.2.2)
26
27
  prawn (>= 1.3.0, < 3.0.0)
27
28
  pry (0.11.3)
28
29
  coderay (~> 1.1.0)
29
30
  method_source (~> 0.9.0)
30
- rake (12.3.0)
31
+ rake (13.0.6)
31
32
  rspec (3.7.0)
32
33
  rspec-core (~> 3.7.0)
33
34
  rspec-expectations (~> 3.7.0)
@@ -41,16 +42,19 @@ GEM
41
42
  diff-lcs (>= 1.2.0, < 2.0)
42
43
  rspec-support (~> 3.7.0)
43
44
  rspec-support (3.7.1)
45
+ ruby-ole (1.2.12.2)
44
46
  simplecov (0.13.0)
45
47
  docile (~> 1.1.0)
46
48
  json (>= 1.8, < 3)
47
49
  simplecov-html (~> 0.10.0)
48
50
  simplecov-html (0.10.0)
49
- terminal-table (1.8.0)
50
- unicode-display_width (~> 1.1, >= 1.1.1)
51
- thor (0.20.0)
52
- ttfunk (1.5.1)
53
- unicode-display_width (1.3.0)
51
+ spreadsheet (1.2.6)
52
+ ruby-ole (>= 1.0)
53
+ terminal-table (3.0.2)
54
+ unicode-display_width (>= 1.1.1, < 3)
55
+ thor (1.2.1)
56
+ ttfunk (1.7.0)
57
+ unicode-display_width (2.4.2)
54
58
 
55
59
  PLATFORMS
56
60
  ruby
@@ -61,6 +65,7 @@ DEPENDENCIES
61
65
  pry
62
66
  rspec
63
67
  simplecov
68
+ spreadsheet
64
69
 
65
70
  BUNDLED WITH
66
- 1.15.3
71
+ 2.3.7
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
  [![Build Status](https://travis-ci.org/igorkasyanchuk/log_analyzer.svg?branch=master)](https://travis-ci.org/igorkasyanchuk/log_analyzer)
2
+ [![RailsJazz](https://github.com/igorkasyanchuk/rails_time_travel/blob/main/docs/my_other.svg?raw=true)](https://www.railsjazz.com)
3
+ [![https://www.patreon.com/igorkasyanchuk](https://github.com/igorkasyanchuk/rails_time_travel/blob/main/docs/patron.svg?raw=true)](https://www.patreon.com/igorkasyanchuk)
2
4
 
3
5
  # LogAnalyzer
4
6
 
@@ -49,11 +51,13 @@ Samples:
49
51
  * `log_analyzer production.log -pdf`
50
52
  * `log_analyzer -f log/production.log -s name`
51
53
  * `log_analyzer -f log/production.log -s time -f v`
54
+ * `log_analyzer -f log/production.log -s rtime -f v`
52
55
  * `log_analyzer -file log/production.log -sort count`
53
56
  * `log_analyzer -file log/production.log -sort count -filter view`
54
57
  * `log_analyzer -file log/production.log -sort count -filter partial`
55
58
  * `log_analyzer -file log/production.log -sort time -filter p`
56
59
  * `log_analyzer development.log -csv -s time -f p`
60
+ * `log_analyzer development.log -xls -s time -f p`
57
61
  * `log_analyzer log/production.log -pdf --short`
58
62
  * `log_analyzer -file log/production.log --short`
59
63
  * `log_analyzer --help`
@@ -80,6 +84,7 @@ Big thank you to all our contributors:
80
84
  * [@ritaritual](https://github.com/ritaritual)
81
85
  * [@y-yagi](https://github.com/y-yagi)
82
86
  * [@RafaelHashimoto](https://github.com/RafaelHashimoto)
87
+ * [@Quentinchampenois](https://github.com/Quentinchampenois)
83
88
 
84
89
  ## TODO
85
90
 
@@ -92,3 +97,5 @@ Big thank you to all our contributors:
92
97
 
93
98
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
94
99
 
100
+ [<img src="https://github.com/igorkasyanchuk/rails_time_travel/blob/main/docs/more_gems.png?raw=true"
101
+ />](https://www.railsjazz.com/?utm_source=github&utm_medium=bottom&utm_campaign=log_analyzer)
data/bin/log_analyzer CHANGED
@@ -35,6 +35,10 @@ parser = OptionParser.new do |opts|
35
35
  options[:format] = 'csv'
36
36
  end
37
37
 
38
+ opts.on('-xls', '--output=xls', 'Export to .xls') do |v|
39
+ options[:format] = 'xls'
40
+ end
41
+
38
42
  opts.on('-h', '--help', 'Displays Help') do
39
43
  puts opts
40
44
  exit
@@ -65,6 +69,8 @@ if options[:file] && options[:sort]
65
69
  analyzer.to_pdf(LogAnalyzer::Utils.report_name('pdf'), short: options[:short])
66
70
  when 'csv'
67
71
  analyzer.to_csv(LogAnalyzer::Utils.report_name('csv'), short: options[:short])
72
+ when 'xls'
73
+ analyzer.to_xls(LogAnalyzer::Utils.report_name('xls'), short: options[:short])
68
74
  else
69
75
  analyzer.visualize(short: options[:short])
70
76
  end
@@ -1,5 +1,5 @@
1
1
  module LogAnalyzer
2
-
2
+
3
3
  class Analyzer
4
4
  DEFAULT_TABLE_WIDTH = 120 # width
5
5
  CONTENT_LENGTH = (0..DEFAULT_TABLE_WIDTH - 20).freeze
@@ -36,6 +36,8 @@ module LogAnalyzer
36
36
  @stats = @stats.sort{|a, b| a[0] <=> b[0] }
37
37
  when :time
38
38
  @stats = @stats.sort{|a, b| a[1].avg <=> b[1].avg }
39
+ when :rtime
40
+ @stats = @stats.sort{|a, b| b[1].avg <=> a[1].avg }
39
41
  when :count
40
42
  @stats = @stats.sort{|a, b| a[1].count <=> b[1].count }
41
43
  end
@@ -98,6 +100,21 @@ module LogAnalyzer
98
100
  end
99
101
  end
100
102
 
103
+ def to_xls(out_filename, short: false)
104
+ xls = Spreadsheet::Workbook.new
105
+ xls.create_worksheet
106
+ #XLS header
107
+ xls.worksheet(0).insert_row(0, HEADER)
108
+ #XLS content
109
+ stats.each do |path, stat|
110
+ xls.worksheet(0).insert_row(
111
+ xls.worksheet(0).last_row_index + 1,
112
+ xls_format_row(path, stat, short)
113
+ )
114
+ end
115
+ xls.write("#{Dir.pwd}/#{out_filename}")
116
+ end
117
+
101
118
  private
102
119
 
103
120
  def console_row(path, stat, short)
@@ -124,6 +141,7 @@ module LogAnalyzer
124
141
 
125
142
  alias :pdf_row :simple_row
126
143
  alias :csv_format_row :simple_row
144
+ alias :xls_format_row :simple_row
127
145
 
128
146
  def new_table
129
147
  Terminal::Table.new(headings: HEADER, width: DEFAULT_TABLE_WIDTH)
@@ -1,3 +1,3 @@
1
1
  module LogAnalyzer
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.3"
3
3
  end
data/lib/log_analyzer.rb CHANGED
@@ -3,6 +3,7 @@ require "colorize"
3
3
  require "prawn"
4
4
  require "prawn/table"
5
5
  require "csv"
6
+ require 'spreadsheet'
6
7
  require "log_analyzer/version"
7
8
  require "log_analyzer/configuration"
8
9
  require "log_analyzer/utils"
data/log_analyzer.gemspec CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_dependency "colorize"
29
29
  spec.add_dependency "prawn"
30
30
  spec.add_dependency "prawn-table"
31
+ spec.add_dependency "spreadsheet"
31
32
 
32
33
  spec.add_development_dependency "bundler", "> 1.14"
33
34
  spec.add_development_dependency "rspec", "~> 3.0"
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.3.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-02 00:00:00.000000000 Z
11
+ date: 2023-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: spreadsheet
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: bundler
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -176,7 +190,7 @@ homepage: https://github.com/igorkasyanchuk
176
190
  licenses:
177
191
  - MIT
178
192
  metadata: {}
179
- post_install_message:
193
+ post_install_message:
180
194
  rdoc_options: []
181
195
  require_paths:
182
196
  - lib
@@ -191,9 +205,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
205
  - !ruby/object:Gem::Version
192
206
  version: '0'
193
207
  requirements: []
194
- rubyforge_project:
195
- rubygems_version: 2.6.12
196
- signing_key:
208
+ rubygems_version: 3.2.3
209
+ signing_key:
197
210
  specification_version: 4
198
211
  summary: log_analyzer gem is created to get statistics about your views rendering
199
212
  performance.