tanga_services 0.0.7 → 0.0.8

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: 9405611e6a2f2f1657819329c428afc727fa5dd4
4
- data.tar.gz: 9415aa37acb99af21f00bf96258cffa42781c606
3
+ metadata.gz: 1549a8ff27e55f3795d8bae0e5726bfc697d825a
4
+ data.tar.gz: f3844a6357b9887a5bd84bfc19f0a7764c24968b
5
5
  SHA512:
6
- metadata.gz: 7927807257ef6cd66c5be4dbfa72ae83738b16f58f4740e6538710fd88a407a3db491743cc9cc85870029c6d326f14377340432cf53229b230eb5114f329df76
7
- data.tar.gz: 1a6824b0f8eff24defd80dd51c9f9b673ac623c2a411ea292522e92adf245f0ee79f76bc1bcb72a526d6dd57a293fd042accd7921da8a58ed8370a301b5ef937
6
+ metadata.gz: f862168a6ef9e9a2a776d2be7eefeeb54dcb5fc88238fa80d15ed30d4f35e7a8a0ab8890eb4e758836de3709be0ddcd14487a9dd70eb0bdad480d9f35f2afd58
7
+ data.tar.gz: 83f2a2e675277defb14fa99e40f63718ab65b66ca5b4e21652bc1fbf89ccedb35420022dc4efcc23dbf40afc5a8ecca116cff284194f5a26de42cad25caca8eb
@@ -46,6 +46,10 @@ module TangaServices
46
46
 
47
47
  def self.log(level, hash)
48
48
  fail ArgumentError, 'must have application_name set' unless @logger
49
+ unless hash.is_a?(Hash)
50
+ hash = { object: hash }
51
+ end
52
+
49
53
  fail ArgumentError, 'we just log hashes' unless hash.is_a?(Hash)
50
54
  data = { level: level, object: hash }
51
55
  @logger.send(level, data.to_json)
@@ -1,3 +1,3 @@
1
1
  module TangaServices
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/spec/logger_spec.rb CHANGED
@@ -24,12 +24,6 @@ describe TangaServices do
24
24
  end
25
25
 
26
26
  context '.log' do
27
- it 'requires you log a hash' do
28
- TangaServices.logger.application_name = 'app'
29
- expect{TangaServices.logger.info('not a hash')}.to \
30
- raise_error(ArgumentError, "we just log hashes")
31
- end
32
-
33
27
  it 'makes you set application name before' do
34
28
  expect{TangaServices.logger.info('not a hash')}.to \
35
29
  raise_error(ArgumentError, "must have application_name set")
@@ -56,6 +50,12 @@ describe TangaServices do
56
50
  TangaServices.logger << 'hey there'
57
51
  end
58
52
 
53
+ it 'can log strings' do
54
+ TangaServices.logger.application_name = 'my_app'
55
+ TangaServices.logger.info('hello')
56
+ TangaServices.logger.write('sup')
57
+ end
58
+
59
59
  %w( debug info warn error fatal ).each do |method|
60
60
  it "should log #{ method}" do
61
61
  logger = instance_double(Syslog::Logger)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tanga_services
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Van Dyk