mixlib-log 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
  SHA256:
3
- metadata.gz: 032aa8e0efc805397575ca65b6ac96af30afc37e027f21268d4ff3c17ab854d4
4
- data.tar.gz: 6b599cf65fa6814a5d600db8530e036197a9960b52afea9f886495095d5573b6
3
+ metadata.gz: b7214ac3d468a8800acce46ecd0838dbbb55e88882d22f7061b96fafd6d3bafa
4
+ data.tar.gz: eb8e35f818fe41b720b4725311cea852647adc42579f2ab4276f07ce29d66308
5
5
  SHA512:
6
- metadata.gz: c8bbbc21e0f7108f3ccc9a93ccd8ddbc43e05244ec982c1cd70c2353992f15926417e17190ee09a1c9e84e178b5f4533a14ce27612797e53509e07b60fdc62b5
7
- data.tar.gz: ffe35cc1471bf287c4d616a812c5406caeadc38c98ad071294d077e6b29a11d4a15ed2c00f3de6d2467a9bed2fdc644a35b4d74f3e2bd58dbb5bcf23b1e83123
6
+ metadata.gz: 8ffde80cd3b1f74898c1d060ba02d98b4132e07e0bff10f19f42fed4d99b9ce4e91652d83695859fc62abf979ffc21c5b04654013f54b85cddbd96165ba3e98d
7
+ data.tar.gz: 13fb341dbfc6333bd4477b08b543ee2a7a886a2f91d36db869a566b8159e546bb0ff6a4ea819b6575b8bb7b4f773fdcfe6d4f628b66464462b423f675e6514fc
@@ -31,6 +31,7 @@ module Mixlib
31
31
  def reset!
32
32
  close!
33
33
  @logger, @loggers = nil, nil
34
+ @metadata = {}
34
35
  end
35
36
 
36
37
  # An Array of log devices that will be logged to. Defaults to just the default
@@ -92,6 +93,8 @@ module Mixlib
92
93
  @configured
93
94
  end
94
95
 
96
+ attr_accessor :metadata
97
+
95
98
  # Sets the level for the Logger object by symbol. Valid arguments are:
96
99
  #
97
100
  # :trace
@@ -22,6 +22,7 @@ module Mixlib
22
22
  include Mixlib::Log::Logging
23
23
 
24
24
  attr_reader :parent
25
+ attr_accessor :metadata
25
26
  def initialize(parent, metadata = {})
26
27
  @parent = parent
27
28
  @metadata = metadata
@@ -45,6 +45,7 @@ module Mixlib
45
45
  level = LEVELS[method_name]
46
46
  define_method(method_name) do |msg = nil, data: {}, &block|
47
47
  pass(level, msg, data: data, &block)
48
+ nil
48
49
  end
49
50
  end
50
51
 
@@ -1,5 +1,5 @@
1
1
  module Mixlib
2
2
  module Log
3
- VERSION = "2.0.0"
3
+ VERSION = "2.0.1"
4
4
  end
5
5
  end
@@ -200,4 +200,23 @@ RSpec.describe Mixlib::Log do
200
200
  expect(opened_files_count_after).to eq(opened_files_count_before + 1)
201
201
  end
202
202
 
203
+ it "should return nil from its logging methods" do
204
+ expect(Logger).to receive(:new).with(STDOUT) { double("a-quiet-logger").as_null_object }
205
+ Logit.init
206
+
207
+ aggregate_failures "returns nil from logging method" do
208
+ expect(Logit.trace("hello")).to be_nil
209
+ expect(Logit.debug("hello")).to be_nil
210
+ expect(Logit.info("hello")).to be_nil
211
+ expect(Logit.warn("hello")).to be_nil
212
+ expect(Logit.error("hello")).to be_nil
213
+ expect(Logit.fatal("hello")).to be_nil
214
+ end
215
+ end
216
+
217
+ it "should set metadata correctly" do
218
+ Logit.metadata = { test: "data" }
219
+ expect(Logit.metadata).to eql({ test: "data" })
220
+ end
221
+
203
222
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixlib-log
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
  - Chef Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-27 00:00:00.000000000 Z
11
+ date: 2018-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake