loog 0.3.1 → 0.4.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: a2662abfce60be64b01efbd3ed10c270b3c428acd81c0836e78404d0117a4fa7
4
- data.tar.gz: be86fa2d1456d366135e778f8c8da1d67ef1690b0625fa5a7656e28cac13e757
3
+ metadata.gz: 36176706198bed42b0858771358d9c016f39437fa5a9fedc6391fab3cf8d1518
4
+ data.tar.gz: 9ef77b0a794eb04027e16fbd12cf208488bc6052ee87ba7de9bd839188d6c6a9
5
5
  SHA512:
6
- metadata.gz: 35804d417e1054e73f031ce1f3a2cad69d5765b8fdace16f8812b2f1dc61efd371eb59a090e3d4b274efed7e7544d9e688b1171702c5226ce26665cb23c34de5
7
- data.tar.gz: 46c6b5bc84b603a64a62e6506de8bbbcefb52f264a9b1962b1d20b92cca78c219b5d806051d3daae2bbb2243e4577188467362c0f5cff5069cee8b9b1ebe1544
6
+ metadata.gz: 9ede844cd2c3f8740de75171320397bdc01ecafe2ec5212dfaf76aa68ea85b7f02f4a5c21d0abf6f15173e2bc3b1e69caebc00d7526dc38a90cbde579fb820bb
7
+ data.tar.gz: ccb2526f6c8eb792cf16162e35b2f06638ac53d6aaa2cc1f26de86ddcbd28dc4b2c73a7c0cbecd495bbf29eee76bbc4f5465b1bf617079e5a20e368f8be58bb7
data/.rultor.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  docker:
2
- image: yegor256/rultor-image:1.9.1
2
+ image: yegor256/rultor-image:1.21.0
3
3
  assets:
4
4
  rubygems.yml: yegor256/home#assets/rubygems.yml
5
5
  install: |
data/Gemfile CHANGED
@@ -22,3 +22,10 @@
22
22
 
23
23
  source 'https://rubygems.org'
24
24
  gemspec
25
+
26
+ gem 'minitest', '5.18.0', require: false
27
+ gem 'rake', '13.0.6', require: false
28
+ gem 'rdoc', '6.5.0', require: false
29
+ gem 'rubocop', '1.48.1', require: false
30
+ gem 'rubocop-rspec', '2.19.0', require: false
31
+ gem 'simplecov', '0.22.0', require: false
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  <img src="/logo.svg" width="64px" height="64px"/>
2
2
 
3
- [![Managed by Zerocracy](https://www.0crat.com/badge/C3RFVLU72.svg)](https://www.0crat.com/p/C3RFVLU72)
4
3
  [![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
5
4
  [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/loog)](http://www.rultor.com/p/yegor256/loog)
6
5
  [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
@@ -32,7 +31,9 @@ The gem is basically a provider of a few pre-configured loggers, which
32
31
  you can use for production (`Loog::REGULAR`) or for testing (`Loog::VERBOSE`).
33
32
  You can also shut it up with `Loog::NULL`.
34
33
 
35
- That's it.
34
+ There is also `Logger::Buffer` class that you can use for testing.
35
+ It accumulates all log calls and then returns the entire output
36
+ through the `to_s()` method.
36
37
 
37
38
  ## How to contribute
38
39
 
data/lib/loog.rb CHANGED
@@ -86,4 +86,26 @@ module Loog
86
86
  ERRORS.level = Logger::ERROR
87
87
  ERRORS.formatter = COMPACT
88
88
  ERRORS.freeze
89
+
90
+ # Accumulator of everything. This class may be used
91
+ # for testing, when it's necessary to accumulate all log
92
+ # messages in one place and then "assert" the presence
93
+ # of certain strings inside them.
94
+ class Buffer < Logger
95
+ def initialize
96
+ super(
97
+ $stdout,
98
+ level: Logger::DEBUG,
99
+ formatter: proc do |severity, time, target, msg|
100
+ @lines.push("#{severity} #{time} #{target} #{msg}")
101
+ ''
102
+ end
103
+ )
104
+ @lines = []
105
+ end
106
+
107
+ def to_s
108
+ @lines.join("\n")
109
+ end
110
+ end
89
111
  end
data/loog.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
28
28
  s.required_ruby_version = '>=2.3'
29
29
  s.name = 'loog'
30
- s.version = '0.3.1'
30
+ s.version = '0.4.0'
31
31
  s.license = 'MIT'
32
32
  s.summary = 'Object-oriented logging wrapper'
33
33
  s.description = 'Object-oriented wrapper for Ruby default logging facility'
@@ -37,11 +37,5 @@ Gem::Specification.new do |s|
37
37
  s.files = `git ls-files`.split($RS)
38
38
  s.rdoc_options = ['--charset=UTF-8']
39
39
  s.extra_rdoc_files = ['README.md']
40
- s.add_development_dependency 'codecov', '0.6.0'
41
- s.add_development_dependency 'minitest', '5.18.0'
42
- s.add_development_dependency 'rake', '13.0.6'
43
- s.add_development_dependency 'rdoc', '6.5.0'
44
- s.add_development_dependency 'rubocop', '1.48.1'
45
- s.add_development_dependency 'rubocop-rspec', '2.19.0'
46
40
  s.metadata['rubygems_mfa_required'] = 'true'
47
41
  end
data/test/test__helper.rb CHANGED
@@ -24,7 +24,3 @@ $stdout.sync = true
24
24
 
25
25
  require 'simplecov'
26
26
  SimpleCov.start
27
- if ENV['CI'] == 'true'
28
- require 'codecov'
29
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
30
- end
data/test/test_loog.rb CHANGED
@@ -37,4 +37,10 @@ class LoogTest < Minitest::Test
37
37
  def test_null_logging
38
38
  Loog::NULL.info('Should not be visible')
39
39
  end
40
+
41
+ def test_buffering
42
+ b = Loog::Buffer.new
43
+ b.info('Hello, world!')
44
+ assert b.to_s.include?('Hello')
45
+ end
40
46
  end
metadata CHANGED
@@ -1,99 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-22 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: codecov
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '='
18
- - !ruby/object:Gem::Version
19
- version: 0.6.0
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '='
25
- - !ruby/object:Gem::Version
26
- version: 0.6.0
27
- - !ruby/object:Gem::Dependency
28
- name: minitest
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '='
32
- - !ruby/object:Gem::Version
33
- version: 5.18.0
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '='
39
- - !ruby/object:Gem::Version
40
- version: 5.18.0
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '='
46
- - !ruby/object:Gem::Version
47
- version: 13.0.6
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '='
53
- - !ruby/object:Gem::Version
54
- version: 13.0.6
55
- - !ruby/object:Gem::Dependency
56
- name: rdoc
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '='
60
- - !ruby/object:Gem::Version
61
- version: 6.5.0
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '='
67
- - !ruby/object:Gem::Version
68
- version: 6.5.0
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '='
74
- - !ruby/object:Gem::Version
75
- version: 1.48.1
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '='
81
- - !ruby/object:Gem::Version
82
- version: 1.48.1
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop-rspec
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '='
88
- - !ruby/object:Gem::Version
89
- version: 2.19.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '='
95
- - !ruby/object:Gem::Version
96
- version: 2.19.0
11
+ date: 2023-07-28 00:00:00.000000000 Z
12
+ dependencies: []
97
13
  description: Object-oriented wrapper for Ruby default logging facility
98
14
  email: yegor256@gmail.com
99
15
  executables: []
@@ -147,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
63
  - !ruby/object:Gem::Version
148
64
  version: '0'
149
65
  requirements: []
150
- rubygems_version: 3.1.2
66
+ rubygems_version: 3.2.15
151
67
  signing_key:
152
68
  specification_version: 4
153
69
  summary: Object-oriented logging wrapper