conscriptor 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34181222df46d9b305f28dacb4d0bfe5580b167149c3af54c1b7eb6b283afc10
4
- data.tar.gz: b70506321c62b6b27a59b24fabe7686965282d3c9729ac370fe2d4c04c082103
3
+ metadata.gz: 813e5ddcaf6c0f60392cce10af1a7fc2a19d8ca6cb00c841e84a47a270b37c32
4
+ data.tar.gz: 93613e8f1f1289eb0b3051d570620dadf24eb58758a729d3833eec70382d5cca
5
5
  SHA512:
6
- metadata.gz: f1d63a3b20b4d384122eb13050d55689dc1406793bea7595a1fe501551201a2e58424c13865545fa6ec151e2239fc47689756aed0c2f75795b223035a5bed5e2
7
- data.tar.gz: 3e69376b0f1a274f9e35d896c0b7734ee64d624a25bd656e3a436b1703db4d36780c9f66d539be85440cbfb30dec14cbd5b46ff8ba5ab53670eb8d30717dd0cc
6
+ metadata.gz: 693c6ec028d4d6b57359cf841432b27a48e0897c7dfc40579d4fee5fe84f24bac04d62d6f371c46e60e8dba8dc6681f7c8566865059bcd4d01dcab77f0894b1a
7
+ data.tar.gz: 503c1413da9063b4a8031060a7917240ce2fa0038897cd71515b10f41d0fb070c4624822c02bfa1124a7b9c3927048c70943232961a5655cd867a6c7a3efed19
data/lib/conscriptor.rb CHANGED
@@ -88,8 +88,8 @@ module Conscriptor
88
88
 
89
89
  # usage:
90
90
  # start_timer total: Lesson.count, report_every: 100
91
- def start_timer(name: nil, total: nil, report_every: nil, log: nil)
92
- @progress = Conscriptor::ProgressReporter.new(name: name, total: total, report_every: report_every, log: log)
91
+ def start_timer(name: nil, total: nil, report_every: nil, logger: nil)
92
+ @progress = Conscriptor::ProgressReporter.new(name: name, total: total, report_every: report_every, logger: logger)
93
93
  end
94
94
 
95
95
  def inc_timer(by: 1)
@@ -1,11 +1,11 @@
1
1
  require_relative './histogram'
2
- require 'logger'
2
+ require_relative './simple_logger'
3
3
 
4
4
  module Conscriptor
5
5
  class EventCounter
6
6
  include Histogram
7
7
 
8
- def initialize(logger=Logger.new($stdout))
8
+ def initialize(logger=simple_logger)
9
9
  @logger = logger
10
10
  clear
11
11
  end
@@ -1,4 +1,4 @@
1
- require 'logger'
1
+ require_relative './simple_logger'
2
2
 
3
3
  module Conscriptor
4
4
  class ProgressReporter
@@ -8,7 +8,7 @@ module Conscriptor
8
8
  @name = name
9
9
  @total = total
10
10
  @report_every = report_every || 1
11
- @logger = logger || Logger.new($stdout)
11
+ @logger = logger || simple_logger
12
12
  @count = 0
13
13
  @start_time = Time.now
14
14
  end
@@ -0,0 +1,9 @@
1
+ require 'logger'
2
+
3
+ def simple_logger
4
+ logger = Logger.new($stdout)
5
+ logger.formatter = proc do |_severity, _datetime, _progname, msg|
6
+ msg.to_s
7
+ end
8
+ logger
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Conscriptor
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conscriptor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Lightsmith
@@ -25,6 +25,7 @@ files:
25
25
  - lib/conscriptor/histogram.rb
26
26
  - lib/conscriptor/progress_reporter.rb
27
27
  - lib/conscriptor/say.rb
28
+ - lib/conscriptor/simple_logger.rb
28
29
  - lib/conscriptor/version.rb
29
30
  homepage: https://github.com/jeremylightsmith/conscriptor
30
31
  licenses: