loog 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -1
- data/.rultor.yml +1 -1
- data/.simplecov +7 -5
- data/Gemfile +7 -0
- data/README.md +3 -2
- data/lib/loog.rb +28 -8
- data/loog.gemspec +3 -13
- data/test/test__helper.rb +1 -5
- data/test/test_loog.rb +6 -0
- metadata +8 -94
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36176706198bed42b0858771358d9c016f39437fa5a9fedc6391fab3cf8d1518
|
4
|
+
data.tar.gz: 9ef77b0a794eb04027e16fbd12cf208488bc6052ee87ba7de9bd839188d6c6a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ede844cd2c3f8740de75171320397bdc01ecafe2ec5212dfaf76aa68ea85b7f02f4a5c21d0abf6f15173e2bc3b1e69caebc00d7526dc38a90cbde579fb820bb
|
7
|
+
data.tar.gz: ccb2526f6c8eb792cf16162e35b2f06638ac53d6aaa2cc1f26de86ddcbd28dc4b2c73a7c0cbecd495bbf29eee76bbc4f5465b1bf617079e5a20e368f8be58bb7
|
data/.rubocop.yml
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
AllCops:
|
2
2
|
DisplayCopNames: true
|
3
3
|
TargetRubyVersion: 2.3.3
|
4
|
+
SuggestExtensions: false
|
5
|
+
NewCops: enable
|
4
6
|
|
5
7
|
Layout/EmptyLineAfterGuardClause:
|
6
8
|
Enabled: false
|
@@ -16,7 +18,7 @@ Metrics/PerceivedComplexity:
|
|
16
18
|
Max: 10
|
17
19
|
Metrics/ParameterLists:
|
18
20
|
Max: 10
|
19
|
-
Layout/
|
21
|
+
Layout/ParameterAlignment:
|
20
22
|
Enabled: false
|
21
23
|
Style/ClassAndModuleChildren:
|
22
24
|
Enabled: false
|
data/.rultor.yml
CHANGED
data/.simplecov
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2019 Yegor Bugayenko
|
2
4
|
#
|
3
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -18,21 +20,21 @@
|
|
18
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
21
|
# SOFTWARE.
|
20
22
|
|
21
|
-
if Gem.win_platform?
|
23
|
+
if Gem.win_platform?
|
22
24
|
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
23
25
|
SimpleCov::Formatter::HTMLFormatter
|
24
26
|
]
|
25
27
|
SimpleCov.start do
|
26
|
-
add_filter
|
27
|
-
add_filter
|
28
|
+
add_filter '/test/'
|
29
|
+
add_filter '/features/'
|
28
30
|
end
|
29
31
|
else
|
30
32
|
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
31
33
|
[SimpleCov::Formatter::HTMLFormatter]
|
32
34
|
)
|
33
35
|
SimpleCov.start do
|
34
|
-
add_filter
|
35
|
-
add_filter
|
36
|
+
add_filter '/test/'
|
37
|
+
add_filter '/features/'
|
36
38
|
minimum_coverage 60
|
37
39
|
end
|
38
40
|
end
|
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
|
-
|
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
@@ -46,12 +46,12 @@ module Loog
|
|
46
46
|
when 'DEBUG'
|
47
47
|
prefix = 'D: '
|
48
48
|
end
|
49
|
-
prefix
|
49
|
+
"#{prefix}#{msg.to_s.rstrip.gsub(/\n/, "\n#{' ' * prefix.length}")}\n"
|
50
50
|
end
|
51
51
|
|
52
52
|
# Short formatter
|
53
53
|
SHORT = proc do |_severity, _time, _target, msg|
|
54
|
-
msg.to_s.rstrip
|
54
|
+
"#{msg.to_s.rstrip}\n"
|
55
55
|
end
|
56
56
|
|
57
57
|
# Full formatter
|
@@ -65,27 +65,47 @@ module Loog
|
|
65
65
|
end
|
66
66
|
|
67
67
|
# No logging at all
|
68
|
-
NULL = Logger.new(
|
68
|
+
NULL = Logger.new($stdout)
|
69
69
|
NULL.level = Logger::UNKNOWN
|
70
70
|
NULL.freeze
|
71
71
|
|
72
72
|
# Everything, including debug
|
73
|
-
VERBOSE = Logger.new(
|
73
|
+
VERBOSE = Logger.new($stdout)
|
74
74
|
VERBOSE.level = Logger::DEBUG
|
75
75
|
VERBOSE.formatter = COMPACT
|
76
76
|
VERBOSE.freeze
|
77
77
|
|
78
78
|
# Info and errors, no debug info
|
79
|
-
REGULAR = Logger.new(
|
79
|
+
REGULAR = Logger.new($stdout)
|
80
80
|
REGULAR.level = Logger::INFO
|
81
81
|
REGULAR.formatter = COMPACT
|
82
82
|
REGULAR.freeze
|
83
83
|
|
84
84
|
# Errors only
|
85
|
-
ERRORS = Logger.new(
|
85
|
+
ERRORS = Logger.new($stdout)
|
86
86
|
ERRORS.level = Logger::ERROR
|
87
87
|
ERRORS.formatter = COMPACT
|
88
88
|
ERRORS.freeze
|
89
|
-
end
|
90
89
|
|
91
|
-
|
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
|
111
|
+
end
|
data/loog.gemspec
CHANGED
@@ -24,14 +24,10 @@
|
|
24
24
|
|
25
25
|
require 'English'
|
26
26
|
Gem::Specification.new do |s|
|
27
|
-
s.
|
28
|
-
if s.respond_to? :required_rubygems_version=
|
29
|
-
s.required_rubygems_version = Gem::Requirement.new('>= 0')
|
30
|
-
end
|
31
|
-
s.rubygems_version = '2.3.3'
|
27
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
32
28
|
s.required_ruby_version = '>=2.3'
|
33
29
|
s.name = 'loog'
|
34
|
-
s.version = '0.
|
30
|
+
s.version = '0.4.0'
|
35
31
|
s.license = 'MIT'
|
36
32
|
s.summary = 'Object-oriented logging wrapper'
|
37
33
|
s.description = 'Object-oriented wrapper for Ruby default logging facility'
|
@@ -39,13 +35,7 @@ Gem::Specification.new do |s|
|
|
39
35
|
s.email = 'yegor256@gmail.com'
|
40
36
|
s.homepage = 'http://github.com/yegor256/loog'
|
41
37
|
s.files = `git ls-files`.split($RS)
|
42
|
-
s.test_files = s.files.grep(%r{^(test)/})
|
43
38
|
s.rdoc_options = ['--charset=UTF-8']
|
44
39
|
s.extra_rdoc_files = ['README.md']
|
45
|
-
s.
|
46
|
-
s.add_development_dependency 'minitest', '5.11.3'
|
47
|
-
s.add_development_dependency 'rake', '12.0.0'
|
48
|
-
s.add_development_dependency 'rdoc', '4.3.0'
|
49
|
-
s.add_development_dependency 'rubocop', '0.62.0'
|
50
|
-
s.add_development_dependency 'rubocop-rspec', '1.31.0'
|
40
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
51
41
|
end
|
data/test/test__helper.rb
CHANGED
@@ -20,11 +20,7 @@
|
|
20
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
21
|
# SOFTWARE.
|
22
22
|
|
23
|
-
|
23
|
+
$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
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.
|
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-
|
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.11.3
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - '='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 5.11.3
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 12.0.0
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 12.0.0
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rdoc
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 4.3.0
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 4.3.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: 0.62.0
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 0.62.0
|
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: 1.31.0
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - '='
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 1.31.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: []
|
@@ -129,7 +45,8 @@ files:
|
|
129
45
|
homepage: http://github.com/yegor256/loog
|
130
46
|
licenses:
|
131
47
|
- MIT
|
132
|
-
metadata:
|
48
|
+
metadata:
|
49
|
+
rubygems_mfa_required: 'true'
|
133
50
|
post_install_message:
|
134
51
|
rdoc_options:
|
135
52
|
- "--charset=UTF-8"
|
@@ -146,11 +63,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
63
|
- !ruby/object:Gem::Version
|
147
64
|
version: '0'
|
148
65
|
requirements: []
|
149
|
-
rubygems_version: 3.
|
66
|
+
rubygems_version: 3.2.15
|
150
67
|
signing_key:
|
151
|
-
specification_version:
|
68
|
+
specification_version: 4
|
152
69
|
summary: Object-oriented logging wrapper
|
153
|
-
test_files:
|
154
|
-
- test/test__helper.rb
|
155
|
-
- test/test_loog.rb
|
156
|
-
- test/test_tee.rb
|
70
|
+
test_files: []
|