tanga_services 0.0.4 → 0.0.5

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: f5bc75ebb1d4f07a61e642917714d6d196074960
4
- data.tar.gz: 81ae0ec16a625f8d0fbbacc4c8fc6c4bad8e1a04
3
+ metadata.gz: f38deb61725a39955b707bf201ae366cef4e5aac
4
+ data.tar.gz: 562d25ec840601aaf6b626f14367c441ca157573
5
5
  SHA512:
6
- metadata.gz: 4092b869c5f3b5fbfc62e59c24f6da574b346b7d843688ee24ce6162ee9c3bf3bc13a29fccfebf81cf06f0b9ef344d49277c5f6adcd95c08e86021e58b540ca7
7
- data.tar.gz: 80f4fb853bbe53fc0199a1bd76d3466bd868c2defae5ecf37eb62007e02266ba765f33a72a213aebbca9bf885fd82f9e940f513d373c8eb4711172b1fd09f954
6
+ metadata.gz: a25d7ad1d76ffeb3f7f740ce326f2cfee982c7ec66bc8e38becc406c38afc74ca93d0ceb3cfd3d03c25e6a3da4aeab3da99b854f0654f628db449bfa98ca2772
7
+ data.tar.gz: 48dc4c92e38ac7acfbb4d9a5ce6290b43b4730d0dbf84f9e9defa355768dbac866adb4774ce41afb091e99fc7032454584a21e9b0b518a69cd982cb6115f51da
@@ -25,6 +25,13 @@ module TangaServices
25
25
  log(:info, hash)
26
26
  end
27
27
 
28
+ def self.write(message)
29
+ log(:info, message: message)
30
+ end
31
+ class << self
32
+ alias :<< :write
33
+ end
34
+
28
35
  def self.warn(hash)
29
36
  log(:warn, hash)
30
37
  end
@@ -1,3 +1,3 @@
1
1
  module TangaServices
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/spec/logger_spec.rb CHANGED
@@ -14,6 +14,15 @@ describe TangaServices do
14
14
  end
15
15
  end
16
16
 
17
+ context '.logger' do
18
+ it 'should give you access to logger' do
19
+ logger = instance_double(Syslog::Logger)
20
+ expect(Syslog::Logger).to receive(:new).with('my_app', Syslog::LOG_LOCAL7).and_return(logger)
21
+ TangaServices.logger.application_name = 'my_app'
22
+ expect(TangaServices.logger.logger).to be == logger
23
+ end
24
+ end
25
+
17
26
  context '.log' do
18
27
  it 'requires you log a hash' do
19
28
  TangaServices.logger.application_name = 'app'
@@ -26,6 +35,22 @@ describe TangaServices do
26
35
  raise_error(ArgumentError, "must have application_name set")
27
36
  end
28
37
 
38
+ it '#write is an info, can be a string' do
39
+ logger = instance_double(Syslog::Logger)
40
+ expect(Syslog::Logger).to receive(:new).with('my_app', Syslog::LOG_LOCAL7).and_return(logger)
41
+ expect(logger).to receive(:info).with({level: :info, object: {message: 'hey there' } }.to_json)
42
+ TangaServices.logger.application_name = 'my_app'
43
+ TangaServices.logger.write('hey there')
44
+ end
45
+
46
+ it '#<< is an info, can be a string' do
47
+ logger = instance_double(Syslog::Logger)
48
+ expect(Syslog::Logger).to receive(:new).with('my_app', Syslog::LOG_LOCAL7).and_return(logger)
49
+ expect(logger).to receive(:info).with({level: :info, object: {message: 'hey there' } }.to_json)
50
+ TangaServices.logger.application_name = 'my_app'
51
+ TangaServices.logger << 'hey there'
52
+ end
53
+
29
54
  %w( debug info warn error fatal ).each do |method|
30
55
  it "should log #{ method}" do
31
56
  logger = instance_double(Syslog::Logger)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tanga_services
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Van Dyk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-03 00:00:00.000000000 Z
11
+ date: 2015-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape