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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +3 -3
- data/huyegger.gemspec +1 -0
- data/lib/huyegger/formatter.rb +6 -0
- data/lib/huyegger/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb4e026727fa9e4f7335144f84189d139879defc
|
4
|
+
data.tar.gz: 3e9777d895e8a9b3484faa21ffa723eb28c1a460
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4df17f3f4ded9be19a4c27c9b3d64f4c15db2836beaeb79005ec34ab24f16b8920898afb88a286faca413a24d45ca5979c9223d45a3fb020eec388eaa1d70f7f
|
7
|
+
data.tar.gz: ab8db029d77c4b85bbdf9839d72ed4014f2e66142cecf846324274e270e3695e458959d768e2cb473bc661909c7f6c764ec2260753cee4c686bd875a4ef65333
|
data/CHANGELOG.md
CHANGED
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
data/lib/huyegger/formatter.rb
CHANGED
@@ -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}"] ||= {}
|
data/lib/huyegger/version.rb
CHANGED
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.
|
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-
|
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
|