hedgelog 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/.rubocop.yml +4 -0
- data/.travis.yml +1 -0
- data/lib/hedgelog/scrub_replacement.rb +1 -1
- data/lib/hedgelog/version.rb +2 -1
- data/lib/hedgelog.rb +12 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzcxYjAyZTNjNTg1MWY3MjNjOGEzMjI1ZTU1NjQ4YjM5YzA5MTY3ZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2JkZTcyZjQ2ZGFhYjViOTZiMGRjOTdjYjAzOTg3YWRiMTJhMmUzNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MGVlYzkwZDk3MzEzYTYzZjRhNDBlZGU4NTdiOGVlMzIyNzljYmRmMzJkOGI0
|
10
|
+
OWRkMzlhY2I5Nzk4ZWM0Y2Y2ZGU1NmQyOTIzZTUxOTQ3MzBmNTg4ZjBlNzc5
|
11
|
+
OTc4MDEyMzRkOTdhMzEyZWMxNWE3ZjI3MGY4NDZhMWJhNzU2MDc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDQzZmI3YjFjOGI4ZTM3OTlmMmI2ZTZjNTY4MmFjYjAzNzIzNDFmYjg3MDk1
|
14
|
+
ZTcyZjI1MDc4N2VhYTUwMTQyMDc5ZThmN2NkNGQ2NzM1YmFkYWYyMTk5NGFi
|
15
|
+
MTE2ZGYyNjVlODU5OGQyZDFkMTI5MDk5OWQ5YTczMThmNmYyYjM=
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/lib/hedgelog/version.rb
CHANGED
data/lib/hedgelog.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'hedgelog/version'
|
2
3
|
require 'hedgelog/context'
|
3
4
|
require 'hedgelog/scrubber'
|
@@ -13,8 +14,8 @@ class Hedgelog
|
|
13
14
|
h[i] = v.downcase.to_sym
|
14
15
|
end.freeze
|
15
16
|
|
16
|
-
TOP_LEVEL_KEYS = [:app, :channel, :level, :level_name, :message, :request_id, :timestamp]
|
17
|
-
RESERVED_KEYS = [:app, :level, :level_name, :timestamp, :context, :caller]
|
17
|
+
TOP_LEVEL_KEYS = [:app, :channel, :level, :level_name, :message, :request_id, :timestamp].freeze
|
18
|
+
RESERVED_KEYS = [:app, :level, :level_name, :timestamp, :context, :caller].freeze
|
18
19
|
|
19
20
|
TIMESTAMP_FORMAT = '%Y-%m-%dT%H:%M:%S.%6N%z'.freeze
|
20
21
|
BACKTRACE_RE = /([^:]+):([0-9]+)(?::in `(.*)')?/
|
@@ -47,7 +48,7 @@ class Hedgelog
|
|
47
48
|
def add(severity = LEVELS[:unknown], message = nil, progname = nil, context, &block)
|
48
49
|
return true if (@logdev.nil? && @channel.nil?) || severity < @level
|
49
50
|
|
50
|
-
message, context = *
|
51
|
+
message, context = *yield if block
|
51
52
|
context ||= {}
|
52
53
|
|
53
54
|
context = Hedgelog::Context.new(@scrubber, context) unless context.is_a? Hedgelog::Context
|
@@ -126,6 +127,7 @@ class Hedgelog
|
|
126
127
|
data = extract_top_level_keys(data)
|
127
128
|
|
128
129
|
@logdev.write(Yajl::Encoder.encode(data) + "\n")
|
130
|
+
true
|
129
131
|
end
|
130
132
|
|
131
133
|
def default_data(severity)
|
@@ -150,13 +152,13 @@ class Hedgelog
|
|
150
152
|
return unless m
|
151
153
|
path, line, method = m[1..3]
|
152
154
|
whence = $LOAD_PATH.find { |p| path.start_with?(p) }
|
153
|
-
if whence
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
155
|
+
file = if whence
|
156
|
+
# Remove the RUBYLIB path portion of the full file name
|
157
|
+
path[whence.length + 1..-1]
|
158
|
+
else
|
159
|
+
# We get here if the path is not in $:
|
160
|
+
path
|
161
|
+
end
|
160
162
|
|
161
163
|
{
|
162
164
|
file: file,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hedgelog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Utter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yajl-ruby
|