alephant-logger-json 0.1.1 → 0.2.0

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: 0154daa470efe5ef12b3e19a2bb11893cdf4b686
4
- data.tar.gz: c5324b5beaef4b5becf02d4dcd7920d81ae7d154
3
+ metadata.gz: 42fbfe4b5a94e07af82f5b6f0e05bc6b9a946c08
4
+ data.tar.gz: 67381b19f4fa00b7527131ce67ce8ffcd2f1fc57
5
5
  SHA512:
6
- metadata.gz: 219d526f9be1c043f4c83978178c4552f0f950fd0df109bcc675885dc9aa67ff1f4e7f25d581a619cdaca9ce8170cf440ef87972ef13470cb6cb2979bea025be
7
- data.tar.gz: fddbc2a85c4d059daf439a8724999e4c048dd9a1f048eda9b82fb1cf7f22bf9fde40c1cba4d09b2a06e7891c58b69f840067097196cdf6abf0fce2afe6a33aad
6
+ metadata.gz: e8210406b1afde2d6ee4d9ef8bfcab895fb2d03dac0b21e4457ebe7755cc271dda73d82027ffe8daf5e6f693f80a1c78dd02f486082c95e43142baa5696b2256
7
+ data.tar.gz: 21139ea26ff8733c4278fe0bb0c264a3f3db65db41aaf14cd3c577906920f2659a730285644fb472dffb2e6be9b15b8b1782aef67105de042f20561c0d87c0b9
@@ -1,7 +1,7 @@
1
1
  module Alephant
2
2
  module Logger
3
3
  class JSON
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.0"
5
5
  end
6
6
  end
7
7
  end
@@ -13,6 +13,7 @@ module Alephant
13
13
  define_method(level) do |hash|
14
14
  return if hash.is_a? String
15
15
  hash["level"] = level.to_s
16
+ hash["timestamp"] = Time.now.to_s
16
17
  hash = flatten_values_to_s hash unless @nesting
17
18
  @log_file.write(::JSON.generate(hash) + "\n")
18
19
  end
@@ -1,3 +1,4 @@
1
+ require "date"
1
2
  require "spec_helper"
2
3
  require "alephant/logger/json"
3
4
 
@@ -26,6 +27,15 @@ describe Alephant::Logger::JSON do
26
27
 
27
28
  subject.send(level, log_hash)
28
29
  end
30
+
31
+ it "automatically includes a timestamp" do
32
+ expect(log_file).to receive(:write) do |json_dump|
33
+ t = JSON.parse(json_dump)["timestamp"]
34
+ expect{DateTime.parse(t)}.to_not raise_error
35
+ end
36
+
37
+ subject.send(level, log_hash)
38
+ end
29
39
  end
30
40
 
31
41
  shared_context "nested log hash" do
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alephant-logger-json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Arnould
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-13 00:00:00.000000000 Z
11
+ date: 2016-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.7'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec-nc
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake-rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: alephant-logger driver enabling structured logging in JSON
@@ -87,8 +87,8 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
91
- - .rspec
90
+ - ".gitignore"
91
+ - ".rspec"
92
92
  - Gemfile
93
93
  - LICENSE.txt
94
94
  - README.md
@@ -108,17 +108,17 @@ require_paths:
108
108
  - lib
109
109
  required_ruby_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - '>='
111
+ - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '>='
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project:
121
- rubygems_version: 2.0.14
121
+ rubygems_version: 2.2.2
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: alephant-logger driver enabling structured logging in JSON