tanga_services 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tanga_services/logger.rb +4 -0
- data/lib/tanga_services/version.rb +1 -1
- data/spec/logger_spec.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1549a8ff27e55f3795d8bae0e5726bfc697d825a
|
4
|
+
data.tar.gz: f3844a6357b9887a5bd84bfc19f0a7764c24968b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
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)
|