loog 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -1
- data/Gemfile +3 -3
- data/lib/loog.rb +3 -3
- data/loog.gemspec +1 -1
- data/test/test_loog.rb +11 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cea04c3238de13e46a75055d845151bc907c33e7f50c34a48574f66f7cf27f07
|
4
|
+
data.tar.gz: f6024f8ed1224ae10c09e280d9948ab5a0a1d04e92ac58aed1f198b4beb934a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bf3a37ccbcaa2f9569622329dbd1134851571151fb56701a1f5bd151deec3e514f2120a39f43892b629450b4a5fb7574dcd87526d0ff65d5bc093c3524b5da5
|
7
|
+
data.tar.gz: 8994f5542b0a63ed5f7526e47884e30163df2f081a7c0524cb746294af7c2f5d68b16d4befe55ab88fd5144e60d86329522424a8567c17682e33ab280fbf14a7
|
data/.github/workflows/rake.yml
CHANGED
data/Gemfile
CHANGED
@@ -23,9 +23,9 @@
|
|
23
23
|
source 'https://rubygems.org'
|
24
24
|
gemspec
|
25
25
|
|
26
|
-
gem 'minitest', '5.
|
26
|
+
gem 'minitest', '5.19.0', require: false
|
27
27
|
gem 'rake', '13.0.6', require: false
|
28
28
|
gem 'rdoc', '6.5.0', require: false
|
29
|
-
gem 'rubocop', '1.
|
30
|
-
gem 'rubocop-rspec', '2.
|
29
|
+
gem 'rubocop', '1.54.2', require: false
|
30
|
+
gem 'rubocop-rspec', '2.22.0', require: false
|
31
31
|
gem 'simplecov', '0.22.0', require: false
|
data/lib/loog.rb
CHANGED
@@ -46,7 +46,7 @@ module Loog
|
|
46
46
|
when 'DEBUG'
|
47
47
|
prefix = 'D: '
|
48
48
|
end
|
49
|
-
"#{prefix}#{msg.to_s.rstrip.gsub(
|
49
|
+
"#{prefix}#{msg.to_s.rstrip.gsub("\n", "\n#{' ' * prefix.length}")}\n"
|
50
50
|
end
|
51
51
|
|
52
52
|
# Short formatter
|
@@ -92,12 +92,12 @@ module Loog
|
|
92
92
|
# messages in one place and then "assert" the presence
|
93
93
|
# of certain strings inside them.
|
94
94
|
class Buffer < Logger
|
95
|
-
def initialize
|
95
|
+
def initialize(formatter: Loog::SHORT)
|
96
96
|
super(
|
97
97
|
$stdout,
|
98
98
|
level: Logger::DEBUG,
|
99
99
|
formatter: proc do |severity, time, target, msg|
|
100
|
-
@lines.push(
|
100
|
+
@lines.push(formatter.call(severity, time, target, msg))
|
101
101
|
''
|
102
102
|
end
|
103
103
|
)
|
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.
|
30
|
+
s.version = '0.5.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'
|
data/test/test_loog.rb
CHANGED
@@ -39,8 +39,17 @@ class LoogTest < Minitest::Test
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def test_buffering
|
42
|
+
b = Loog::Buffer.new(formatter: Loog::FULL)
|
43
|
+
b.debug('Hello, world!')
|
44
|
+
stdout = b.to_s
|
45
|
+
assert(stdout.include?('Hello'))
|
46
|
+
assert(stdout.include?('DEBUG'))
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_quiet_buffering
|
42
50
|
b = Loog::Buffer.new
|
43
|
-
|
44
|
-
|
51
|
+
msg = 'Hey, друг!'
|
52
|
+
b.info(msg)
|
53
|
+
assert_equal(b.to_s, "#{msg}\n")
|
45
54
|
end
|
46
55
|
end
|