multiple_devices_logger 2.0.0 → 2.0.1

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
  SHA1:
3
- metadata.gz: 8ae86567df1e4256c8ed249fb12684753e072f26
4
- data.tar.gz: cf237ccec6259568639c300bcd70ecb883fca1f0
3
+ metadata.gz: 44858a5a4340b4bf2e87fd6a055597ae7fd0ee5b
4
+ data.tar.gz: 26f49ce243bb8efa0f4124cfb7606c691bd2b2e4
5
5
  SHA512:
6
- metadata.gz: 2ee12be1c9b809603600ef58a6615ee5973a64a1f43ec6b5e9c5092a000cfdd7fd112e2f9e57a1b0ea3e1545884fc29fce0f4c42d5e9ed6c5ffaeec112a77002
7
- data.tar.gz: a2e849b612fe6430eb6826e6d106bc196810f3a7be700622a743a288970ec50fe7f32c79a7c7d5a0b721e350326d489507013036d3e2f24827d0b6bcf385fca5
6
+ metadata.gz: 830be85e5e8d9a906a0233da918e0276b16b90a69a16e053ce80ebc5e96ba19b58e9c2d4d8e3cbd7eda5f474ded7decaf7f3fcd05e5c3668e6558ea70a60882f
7
+ data.tar.gz: 5c221fbdebe6fae49be66f51492f2866880abcba5e31ce54ff4d34822d6bb5d97c979c67889d21ed370b1664f7f4f9a4ff6ab5c42d1cee50c5ba0b03b7d8e404
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.0.1
@@ -1,5 +1,3 @@
1
- require 'active_support/core_ext/array'
2
- require 'active_support/core_ext/object'
3
1
  require 'logger'
4
2
 
5
3
  class MultipleDevicesLogger < Logger
@@ -42,7 +40,7 @@ class MultipleDevicesLogger < Logger
42
40
 
43
41
  def add_device(device, *severities)
44
42
  severities = [severities].flatten
45
- options = severities.extract_options!
43
+ options = severities.last.is_a?(Hash) ? severities.pop : {}
46
44
  formatter = nil
47
45
  if options.key?(:formatter)
48
46
  formatter = options.delete(:formatter)
@@ -74,6 +72,10 @@ class MultipleDevicesLogger < Logger
74
72
  @devices[parse_severity(severity)] || [default_device].compact || []
75
73
  end
76
74
 
75
+ def level=(value)
76
+ super(parse_severity(value))
77
+ end
78
+
77
79
  def reopen(log = nil)
78
80
  raise NotImplementedError.new("#{self.class}#reopen")
79
81
  end
@@ -9,14 +9,12 @@ Gem::Specification.new do |s|
9
9
  s.description = 'Logger that support many and different devices for specified levels'
10
10
  s.license = 'MIT'
11
11
 
12
- s.rubyforge_project = 'multiple_devices_logger'
13
-
14
12
  s.files = `git ls-files`.split("\n")
15
13
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
14
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
15
  s.require_paths = ['lib']
18
16
 
19
- s.add_dependency 'activesupport', '>= 5.0.0', '< 6.0.0'
17
+ s.required_ruby_version = '>= 2.0.0'
20
18
 
21
19
  s.add_development_dependency 'byebug', '>= 9.0.0', '< 10.0.0'
22
20
  s.add_development_dependency 'rake', '>= 12.0.0', '< 13.0.0'
@@ -119,7 +119,7 @@ describe MultipleDevicesLogger do
119
119
  it 'severity can be specified as constant' do
120
120
  expect {
121
121
  logger.add_device(STDERR, Logger::WARN)
122
- }.to change { logger.devices_for(Logger::WARN).first.try(:dev) }.from(nil).to(STDERR)
122
+ }.to change { logger.devices_for(Logger::WARN).size }.by(1)
123
123
  end
124
124
 
125
125
  it 'severity can be specified as symbol' do
@@ -431,6 +431,34 @@ describe MultipleDevicesLogger do
431
431
 
432
432
  end
433
433
 
434
+ describe '#level=' do
435
+
436
+ it 'changes level' do
437
+ expect {
438
+ logger.level = Logger::INFO
439
+ }.to change { logger.level }.to(Logger::INFO)
440
+ end
441
+
442
+ it 'accepts symbols' do
443
+ expect {
444
+ logger.level = :warn
445
+ }.to change { logger.level }.to(Logger::WARN)
446
+ end
447
+
448
+ it 'accepts string' do
449
+ expect {
450
+ logger.level = 'Error'
451
+ }.to change { logger.level }.to(Logger::ERROR)
452
+ end
453
+
454
+ it 'raise an error if invalid' do
455
+ expect {
456
+ logger.level = :foo
457
+ }.to raise_error(ArgumentError, 'Invalid log severity: :foo')
458
+ end
459
+
460
+ end
461
+
434
462
  describe '#log' do
435
463
 
436
464
  it 'works like expected' do
metadata CHANGED
@@ -1,93 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiple_devices_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Toulotte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-23 00:00:00.000000000 Z
11
+ date: 2017-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: activesupport
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 5.0.0
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: 6.0.0
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 5.0.0
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: 6.0.0
33
13
  - !ruby/object:Gem::Dependency
34
14
  name: byebug
35
15
  requirement: !ruby/object:Gem::Requirement
36
16
  requirements:
37
- - - ">="
17
+ - - '>='
38
18
  - !ruby/object:Gem::Version
39
19
  version: 9.0.0
40
- - - "<"
20
+ - - <
41
21
  - !ruby/object:Gem::Version
42
22
  version: 10.0.0
43
23
  type: :development
44
24
  prerelease: false
45
25
  version_requirements: !ruby/object:Gem::Requirement
46
26
  requirements:
47
- - - ">="
27
+ - - '>='
48
28
  - !ruby/object:Gem::Version
49
29
  version: 9.0.0
50
- - - "<"
30
+ - - <
51
31
  - !ruby/object:Gem::Version
52
32
  version: 10.0.0
53
33
  - !ruby/object:Gem::Dependency
54
34
  name: rake
55
35
  requirement: !ruby/object:Gem::Requirement
56
36
  requirements:
57
- - - ">="
37
+ - - '>='
58
38
  - !ruby/object:Gem::Version
59
39
  version: 12.0.0
60
- - - "<"
40
+ - - <
61
41
  - !ruby/object:Gem::Version
62
42
  version: 13.0.0
63
43
  type: :development
64
44
  prerelease: false
65
45
  version_requirements: !ruby/object:Gem::Requirement
66
46
  requirements:
67
- - - ">="
47
+ - - '>='
68
48
  - !ruby/object:Gem::Version
69
49
  version: 12.0.0
70
- - - "<"
50
+ - - <
71
51
  - !ruby/object:Gem::Version
72
52
  version: 13.0.0
73
53
  - !ruby/object:Gem::Dependency
74
54
  name: rspec
75
55
  requirement: !ruby/object:Gem::Requirement
76
56
  requirements:
77
- - - ">="
57
+ - - '>='
78
58
  - !ruby/object:Gem::Version
79
59
  version: 3.5.0
80
- - - "<"
60
+ - - <
81
61
  - !ruby/object:Gem::Version
82
62
  version: 3.6.0
83
63
  type: :development
84
64
  prerelease: false
85
65
  version_requirements: !ruby/object:Gem::Requirement
86
66
  requirements:
87
- - - ">="
67
+ - - '>='
88
68
  - !ruby/object:Gem::Version
89
69
  version: 3.5.0
90
- - - "<"
70
+ - - <
91
71
  - !ruby/object:Gem::Version
92
72
  version: 3.6.0
93
73
  description: Logger that support many and different devices for specified levels
@@ -96,8 +76,8 @@ executables: []
96
76
  extensions: []
97
77
  extra_rdoc_files: []
98
78
  files:
99
- - ".gitignore"
100
- - ".rspec"
79
+ - .gitignore
80
+ - .rspec
101
81
  - Gemfile
102
82
  - MIT-LICENSE
103
83
  - README.mdown
@@ -117,20 +97,18 @@ require_paths:
117
97
  - lib
118
98
  required_ruby_version: !ruby/object:Gem::Requirement
119
99
  requirements:
120
- - - ">="
100
+ - - '>='
121
101
  - !ruby/object:Gem::Version
122
- version: '0'
102
+ version: 2.0.0
123
103
  required_rubygems_version: !ruby/object:Gem::Requirement
124
104
  requirements:
125
- - - ">="
105
+ - - '>='
126
106
  - !ruby/object:Gem::Version
127
107
  version: '0'
128
108
  requirements: []
129
- rubyforge_project: multiple_devices_logger
130
- rubygems_version: 2.5.2
109
+ rubyforge_project:
110
+ rubygems_version: 2.0.14.1
131
111
  signing_key:
132
112
  specification_version: 4
133
113
  summary: Logger than can have many devices
134
- test_files:
135
- - spec/multiple_devices_logger_spec.rb
136
- - spec/spec_helper.rb
114
+ test_files: []