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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTVkYWUyYjFjZWMzMmIzMjlhMzUwNjcwZGQ3MjJhZjZiZjJlODQ0MQ==
4
+ MzcxYjAyZTNjNTg1MWY3MjNjOGEzMjI1ZTU1NjQ4YjM5YzA5MTY3ZQ==
5
5
  data.tar.gz: !binary |-
6
- NWQxODNlNDZkNjQzYzllZTM1MjllYjJkNjBiYjFiNGNiNzI2MjYyNA==
6
+ M2JkZTcyZjQ2ZGFhYjViOTZiMGRjOTdjYjAzOTg3YWRiMTJhMmUzNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZmFmYzE5NzY3YjQyNGIwMDBkN2RmY2I3NmVlZGQwNjBhY2I3ZmIzNzJmYmNj
10
- Yzg0OWRlZmFmZDRhMjEyNDAwYzBmYjYwOGNmNzk3MTFkNTZhNTkzYjdkMjZi
11
- NzYxYjBkMzI5NzdlYmRiMGIxY2VkZTI2YTE5ZGRmYjYyZTY0MGE=
9
+ MGVlYzkwZDk3MzEzYTYzZjRhNDBlZGU4NTdiOGVlMzIyNzljYmRmMzJkOGI0
10
+ OWRkMzlhY2I5Nzk4ZWM0Y2Y2ZGU1NmQyOTIzZTUxOTQ3MzBmNTg4ZjBlNzc5
11
+ OTc4MDEyMzRkOTdhMzEyZWMxNWE3ZjI3MGY4NDZhMWJhNzU2MDc=
12
12
  data.tar.gz: !binary |-
13
- YzZiYTMxMjQ4MTY2ZTZkYzg3YmIzN2Y3NzJhMzA1NzFkNWZmNDJiMzJlYjlh
14
- ZDFlNjIzZjUxYWVmOTU4OWZiNTlkNTZjMGEzNDM0NzFlY2VjNjQ0MDBjZjFi
15
- MzZiM2I4NmM1MDkzMTU5MzkzZDMyZWYzYTdhZmQwYmQwNDhkZWM=
13
+ NDQzZmI3YjFjOGI4ZTM3OTlmMmI2ZTZjNTY4MmFjYjAzNzIzNDFmYjg3MDk1
14
+ ZTcyZjI1MDc4N2VhYTUwMTQyMDc5ZThmN2NkNGQ2NzM1YmFkYWYyMTk5NGFi
15
+ MTE2ZGYyNjVlODU5OGQyZDFkMTI5MDk5OWQ5YTczMThmNmYyYjM=
data/.rubocop.yml CHANGED
@@ -51,3 +51,7 @@ TrivialAccessors:
51
51
 
52
52
  BlockNesting:
53
53
  Max: 4
54
+
55
+ Style/StringLiterals:
56
+ Enabled: true
57
+ EnforcedStyle: single_quotes
data/.travis.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
+ - 2.3.0
4
5
  - 2.2.2
5
6
  - 1.9.3
6
7
  script:
@@ -17,7 +17,7 @@ class Hedgelog
17
17
 
18
18
  def scrub_hash(hash)
19
19
  hash.each do |key, val|
20
- next hash[key] = @replacement if key.to_s.downcase == @key.to_s.downcase
20
+ next hash[key] = @replacement if key.to_s.casecmp(@key.to_s).zero?
21
21
  scrub_thing(val)
22
22
  end
23
23
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class Hedgelog
2
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'.freeze
3
4
  end
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 = *block.call if block
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
- # Remove the RUBYLIB path portion of the full file name
155
- file = path[whence.length + 1..-1]
156
- else
157
- # We get here if the path is not in $:
158
- file = path
159
- end
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.2
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: 2015-09-24 00:00:00.000000000 Z
11
+ date: 2016-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yajl-ruby