kenny 0.1.3 → 0.1.4

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c2ee30aef4af126bb892a5a682a158524d9b4a9
4
- data.tar.gz: 44854a85ae4e02a773594c6f5bb547aa86336ff4
3
+ metadata.gz: 65d75df0f2a722b963a69f8556c3b424ceb233ff
4
+ data.tar.gz: 1539a9b1c5be20a58a9f81bd5dade727daf2ae06
5
5
  SHA512:
6
- metadata.gz: c6972fc555f77201aca2c86bf855a43c287ed419b01ecdc5fc7482476133323d5a2cdd7d00514a5a24241dc06c4f5e8d3e0c9a2ea5fab964b382c5141567bb26
7
- data.tar.gz: 689f0b1c8d4c8d74e871ebf99f66f43140c15aa264e0f7c42ef4edd426ae0ab54aeaa233eccbf6099bfa72f885dd7c6af9dc8a680edcbf768a969e96f4eedb76
6
+ metadata.gz: 17c5ac8693c26600b1deda013fd345dce28095e7a3c549fb36272647270685f59f60059e59870a1a8bd05840719e6cdac79c67d7f2f66d707ae782d04de80012
7
+ data.tar.gz: 4cb7efaacc2ef1ad85b7a4f3bad2ba59d99da3b1b55533bb48ad6a0725507e23ad015cfda454399bbc9b3ff2ad9f2f5670cba68c3851ed27ac1383f788c28dfb
data/README.md CHANGED
@@ -152,3 +152,7 @@ Or command line:
152
152
  Apart from subscribing to instrumentation events and logging, Kenny also provides formatters, which you can attach to a logger.
153
153
 
154
154
  Currently, it only comes with a LogStashFormatter, but feel free to add more Formatters to make this project great.
155
+
156
+ ## Release Notes
157
+ *Version 0.1.4*: LogStashFormatter can take a `type` attribute through the logger's progname. If that is nil, it falls back to the message-hash's `['type']`. If they are all nil, then `type` can still be set through FileBeat's config.
158
+
@@ -4,22 +4,19 @@ require 'active_support'
4
4
 
5
5
  module Kenny
6
6
  module Formatters
7
+ ##
7
8
  # Formats messages as LogStash::Event
9
+ # the 'type' field can be used for ElasticSearch
10
+ # The 'type' could be set through the Logger's progname,
11
+ # which takes the highest precedence.
12
+ # If logger.progname.nil?, it will take the 'type' within the hash.
13
+ # If the 'type' within the Hash is also nil,
14
+ # then you can set the type through FileBeat's config
8
15
  class LogStashFormatter < ::Logger::Formatter
9
- include ActiveSupport::TaggedLogging::Formatter
10
-
11
16
  def call(severity, time, progname, msg)
12
17
  msg = { 'message' => msg.is_a?(String) ? msg : msg.inspect } unless msg.is_a?(Hash)
13
-
14
18
  msg['severity'] = severity if severity
15
- msg['progname'] = progname if progname
16
-
17
- tags = current_tags
18
-
19
- if tags.any?
20
- msg['type'] ||= tags.first
21
- msg['tags'] = tags
22
- end
19
+ msg['type'] = progname if progname
23
20
 
24
21
  event = LogStash::Event.new(msg)
25
22
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kenny
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathias Rüdiger
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-22 00:00:00.000000000 Z
12
+ date: 2016-07-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler