huyegger 0.4.3 → 0.4.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: ba0573ca9cce1a96331b7ba3b2280e2d51f95bde
4
- data.tar.gz: 2fb692f9c463ddf0caaef0d1623928818d6b446e
3
+ metadata.gz: cb4e026727fa9e4f7335144f84189d139879defc
4
+ data.tar.gz: 3e9777d895e8a9b3484faa21ffa723eb28c1a460
5
5
  SHA512:
6
- metadata.gz: f5585b37ee8873d2ef27a8979780dcb8bc226f18f91a385a3886103cd6b78722d14dcba140c51c0b6b794cc5b562afe973e545a4a001106bd035958cb4e158f3
7
- data.tar.gz: 45f8cab131db38d798963d2b5d90381b3d66e152d63f44386a1be6eed457e4635e0cb52c977aeec60da8b4e07a918d9a434c0fc682506046c5a72de37a95c622
6
+ metadata.gz: 4df17f3f4ded9be19a4c27c9b3d64f4c15db2836beaeb79005ec34ab24f16b8920898afb88a286faca413a24d45ca5979c9223d45a3fb020eec388eaa1d70f7f
7
+ data.tar.gz: ab8db029d77c4b85bbdf9839d72ed4014f2e66142cecf846324274e270e3695e458959d768e2cb473bc661909c7f6c764ec2260753cee4c686bd875a4ef65333
data/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ According to https://semver.org/#spec-item-4 0.x versions should not be consider
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## 0.4.4 - 2018-06-18
11
+
12
+ - Add `timestamp` field to all messages.
13
+
10
14
  ## 0.4.3 - 2018-05-28
11
15
 
12
16
  - Fixed double message keys:
data/README.md CHANGED
@@ -25,14 +25,14 @@ logger = Huyegger::Logger.new(syslog_logger)
25
25
 
26
26
  # Write messages:
27
27
  logger.info "log message"
28
- # => { "level": "INFO", "message": "log message" }
28
+ # => { "level": "INFO", "message": "log message", timestamp: "2018-06-18T11:45:54+03:00" }
29
29
  logger.info { "http.host" => "127.0.0.1", message: "log message" }
30
- # => { "level": "INFO", "message": "log message", "http.host": "127.0.0.1" }
30
+ # => { "level": "INFO", "message": "log message", "http.host": "127.0.0.1", timestamp: "2018-06-18T11:45:54+03:00" }
31
31
 
32
32
  # Store context for all log messages, it will be merged to resulting messages
33
33
  logger.context("http.host" => "127.0.0.1")
34
34
  logger.info("log message")
35
- # => { "level": "INFO", "message": "log message", "http.host": "127.0.0.1" }
35
+ # => { "level": "INFO", "message": "log message", "http.host": "127.0.0.1", timestamp: "2018-06-18T11:45:54+03:00" }
36
36
 
37
37
  # Remove context
38
38
  logger.purge_context!
data/huyegger.gemspec CHANGED
@@ -32,4 +32,5 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency "bundler", "~> 1.14"
33
33
  spec.add_development_dependency "rake", "~> 10.0"
34
34
  spec.add_development_dependency "minitest", "~> 5.10"
35
+ spec.add_development_dependency "timecop", "~> 0.9"
35
36
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require "logger"
3
+ require "time"
3
4
 
4
5
  module Huyegger
5
6
  class Formatter
@@ -34,6 +35,7 @@ module Huyegger
34
35
  add_severity!(json_message, severity)
35
36
  json_message.merge!(Huyegger.stringify_keys(__context__))
36
37
  add_message!(json_message, msg)
38
+ add_timestamp(json_message)
37
39
 
38
40
  "#{Huyegger.json_encoder.call(json_message)}\n"
39
41
  end
@@ -63,6 +65,10 @@ module Huyegger
63
65
  end
64
66
  end
65
67
 
68
+ def add_timestamp(json_message)
69
+ json_message['timestamp'] ||= Time.now.xmlschema
70
+ end
71
+
66
72
  def __context__
67
73
  # Use object_id to avoid conflicts with other instances
68
74
  Thread.current[:"__huyegger_context__#{object_id}"] ||= {}
@@ -1,3 +1,3 @@
1
1
  module Huyegger
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: huyegger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikolay Markov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-28 00:00:00.000000000 Z
11
+ date: 2018-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.10'
55
+ - !ruby/object:Gem::Dependency
56
+ name: timecop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.9'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.9'
55
69
  description:
56
70
  email:
57
71
  - mainameiz@gmail.com