logasm 0.2.3 → 0.2.4

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: 89d75c7fbd5b6b266b767c92aa55f963dd3d058e
4
- data.tar.gz: e3425797d5df21071db126019373df4b10036dd7
3
+ metadata.gz: f4fb5320608a9281ac19839580efd95841f32aab
4
+ data.tar.gz: 8430bbe0cbc2da45220dc0561ef930e89186d1bb
5
5
  SHA512:
6
- metadata.gz: e977d912a5e4edf5fb42a426de334131c9802e01759dc0683f2946131308f96c02b5f4b4f39b9e25af114d925cefc20f1ee0d43a9e2915c595b32ff99c890b2d
7
- data.tar.gz: 8222dd3db656c1796075e7df9c25f90dc1aec98ba3ee0163be9385fa87e04ee553f79f6cf286358ee73bb2e536ca0b1a25e8580e435cef31906308abd3e4a197
6
+ metadata.gz: 11bd6d3a0334fab84540705fccb166a50089de39874d6547ce91317ffe798e3d642f7e7f046c1c31a4a93211b3fb31a920e3bd2a9ee564c3f67bf530a97f0288
7
+ data.tar.gz: 2886b7fd506e8da359889c313cf914d85b8083eff115673bf86d7781e2d0569a6a67967daf3ee0b4900b8285767fda433c6c2b64f8906625c5b9d827eb9b2450
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- logasm (0.2.3)
4
+ logasm (0.2.4)
5
5
  inflecto
6
6
 
7
7
  GEM
@@ -13,7 +13,7 @@ GEM
13
13
  amq-protocol (>= 1.9.2)
14
14
  coderay (1.1.0)
15
15
  diff-lcs (1.2.5)
16
- freddy (0.4.1)
16
+ freddy (0.4.2)
17
17
  bunny (= 1.6.3)
18
18
  hamster (~> 1.0.1.pre.rc3)
19
19
  symbolizer
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+
1
3
  require "rspec/core/rake_task"
2
4
  RSpec::Core::RakeTask.new(:spec)
3
5
 
data/lib/logasm/utils.rb CHANGED
@@ -12,12 +12,12 @@ class Logasm
12
12
  #
13
13
  # @return [Hash]
14
14
  def self.build_event(metadata, level, service_name)
15
- metadata.merge(
16
- application: application_name(service_name),
17
- level: level.to_s.downcase,
18
- host: HOST,
19
- :@timestamp => Time.now.utc.iso8601(3)
20
- )
15
+ overwritable_params
16
+ .merge(metadata)
17
+ .merge(
18
+ application: application_name(service_name),
19
+ level: level.to_s.downcase
20
+ )
21
21
  end
22
22
 
23
23
  # Return application name
@@ -31,5 +31,13 @@ class Logasm
31
31
  def self.application_name(service_name)
32
32
  Inflecto.underscore(service_name)
33
33
  end
34
+
35
+ def self.overwritable_params
36
+ {
37
+ :@timestamp => Time.now.utc.iso8601,
38
+ host: HOST
39
+ }
40
+ end
41
+ private_class_method :overwritable_params
34
42
  end
35
43
  end
data/logasm.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "logasm"
7
- gem.version = '0.2.3'
7
+ gem.version = '0.2.4'
8
8
  gem.authors = ["Salemove"]
9
9
  gem.email = ["support@salemove.com"]
10
10
  gem.description = %q{It's logasmic}
data/spec/utils_spec.rb CHANGED
@@ -33,5 +33,23 @@ describe Logasm::Utils do
33
33
  it 'includes the host' do
34
34
  expect(event[:host]).to be_a(String)
35
35
  end
36
+
37
+ context 'when @timestamp provided' do
38
+ let(:metadata) { {message: 'test', :@timestamp => 'a timestamp'} }
39
+
40
+ it 'overwrites @timestamp' do
41
+ expect(subject[:message]).to eq('test')
42
+ expect(subject[:@timestamp]).to eq('a timestamp')
43
+ end
44
+ end
45
+
46
+ context 'when host provided' do
47
+ let(:metadata) { {message: 'test', host: 'xyz'} }
48
+
49
+ it 'overwrites host' do
50
+ expect(subject[:message]).to eq('test')
51
+ expect(subject[:host]).to eq('xyz')
52
+ end
53
+ end
36
54
  end
37
55
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logasm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salemove
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-17 00:00:00.000000000 Z
11
+ date: 2015-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inflecto