franz 1.5.14 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/franz +9 -1
- data/franz.gemspec +1 -0
- data/lib/franz.rb +0 -1
- data/test/test_franz_agg.rb +1 -0
- data/test/test_franz_discover.rb +1 -0
- data/test/test_franz_tail.rb +1 -0
- data/test/test_franz_watch.rb +1 -0
- data/test/test_performance.rb +1 -0
- metadata +16 -3
- data/lib/franz/logger.rb +0 -73
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18808363d0d50ff1f8420104d4146c7b674b809f
|
4
|
+
data.tar.gz: 58388a75b1fb9e762e57cbc23aade7a5edf5f07b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc6d8ca06961fc3f68b2642bbde14f3b22ba96b868c03b35f28a28ce651f56252f8d390063e0005eb68198fd376fdb9e11c1890c3c9e61887c0d93862c4947ae
|
7
|
+
data.tar.gz: 7c1b2175c06e53378d4ba860d9c2b878df70a1eafe7a1d963cb6155e5683352c4f272012dbeb2bb41c758fd5edfb560715a4212a0039769fd29eec877af2dbe0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.6.0
|
data/bin/franz
CHANGED
@@ -3,6 +3,7 @@ require 'json'
|
|
3
3
|
require 'thread'
|
4
4
|
require 'logger'
|
5
5
|
|
6
|
+
require 'slog'
|
6
7
|
require 'bunny'
|
7
8
|
require 'trollop'
|
8
9
|
require 'franz'
|
@@ -42,7 +43,14 @@ end
|
|
42
43
|
Thread.abort_on_exception = true # Die quickly and with great ceremony
|
43
44
|
|
44
45
|
config = Franz::Config.new opts[:config]
|
45
|
-
|
46
|
+
|
47
|
+
level = :info
|
48
|
+
level = :debug if opts[:debug]
|
49
|
+
level = :trace if opts[:trace]
|
50
|
+
colorize, prettify = false, false
|
51
|
+
colorize, prettify = true, true if opts[:log].nil?
|
52
|
+
opts[:log] ||= $stdout
|
53
|
+
logger = Slog.new out: opts[:log], level: level
|
46
54
|
|
47
55
|
io_bound = config[:output][:bound] || 10_000
|
48
56
|
io = Queue.new
|
data/franz.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = Franz::SUMMARY
|
12
12
|
s.description = Franz::SUMMARY + '.'
|
13
13
|
|
14
|
+
s.add_runtime_dependency 'slog', '~> 1'
|
14
15
|
s.add_runtime_dependency 'bunny', '~> 1'
|
15
16
|
s.add_runtime_dependency 'trollop', '~> 2'
|
16
17
|
s.add_runtime_dependency 'colorize', '~> 0'
|
data/lib/franz.rb
CHANGED
@@ -3,7 +3,6 @@ require_relative 'franz/config'
|
|
3
3
|
require_relative 'franz/discover'
|
4
4
|
require_relative 'franz/input'
|
5
5
|
require_relative 'franz/input_config'
|
6
|
-
require_relative 'franz/logger'
|
7
6
|
require_relative 'franz/metadata'
|
8
7
|
require_relative 'franz/output'
|
9
8
|
require_relative 'franz/tail'
|
data/test/test_franz_agg.rb
CHANGED
data/test/test_franz_discover.rb
CHANGED
data/test/test_franz_tail.rb
CHANGED
data/test/test_franz_watch.rb
CHANGED
data/test/test_performance.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: franz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Clemmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: slog
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bunny
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,7 +115,6 @@ files:
|
|
101
115
|
- lib/franz/discover.rb
|
102
116
|
- lib/franz/input.rb
|
103
117
|
- lib/franz/input_config.rb
|
104
|
-
- lib/franz/logger.rb
|
105
118
|
- lib/franz/metadata.rb
|
106
119
|
- lib/franz/output.rb
|
107
120
|
- lib/franz/sash.rb
|
data/lib/franz/logger.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'logger'
|
2
|
-
require 'time'
|
3
|
-
|
4
|
-
require 'colorize'
|
5
|
-
|
6
|
-
|
7
|
-
module Franz
|
8
|
-
|
9
|
-
# Extending the Logger with TRACE capabilities
|
10
|
-
class ::Logger
|
11
|
-
SEV_LABEL << 'TRACE'
|
12
|
-
TRACE = SEV_LABEL.index('TRACE') # N.B. TRACE is above other levels
|
13
|
-
|
14
|
-
# Send a TRACE-level log line
|
15
|
-
def trace progname, &block
|
16
|
-
add TRACE, nil, progname, &block if @trace
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# A colorful JSON logger for Franz.
|
21
|
-
class Logger < Logger
|
22
|
-
# Maps each log level to a unique combination of fore- and background colors
|
23
|
-
SEVERITY_COLORS = {
|
24
|
-
'debug' => [ :blue, :default ],
|
25
|
-
'info' => [ :green, :default ],
|
26
|
-
'warn' => [ :yellow, :default ],
|
27
|
-
'error' => [ :red, :default ],
|
28
|
-
'fatal' => [ :red, :black ],
|
29
|
-
'trace' => [ :magenta, :default ]
|
30
|
-
}
|
31
|
-
|
32
|
-
# Create a new, colorful logger.
|
33
|
-
#
|
34
|
-
# @param debug [Boolean] enable DEBUG level logs
|
35
|
-
# @param out [File] output destination for logs
|
36
|
-
def initialize debug=false, trace=false, out=nil
|
37
|
-
colorize = out.nil?
|
38
|
-
out ||= $stdout
|
39
|
-
super out, 5, 104857600 # Keep max five logs at 100 [MiB] each
|
40
|
-
format colorize
|
41
|
-
@trace = true if trace
|
42
|
-
self.level = ::Logger::INFO
|
43
|
-
self.level = ::Logger::DEBUG if debug
|
44
|
-
end
|
45
|
-
|
46
|
-
private
|
47
|
-
def format colorize
|
48
|
-
self.formatter = proc do |severity, datetime, _, message|
|
49
|
-
severity.downcase!
|
50
|
-
|
51
|
-
message = { message: message } unless message.is_a? Hash
|
52
|
-
|
53
|
-
event = message.merge \
|
54
|
-
'level' => severity,
|
55
|
-
'@timestamp' => datetime.iso8601(3)
|
56
|
-
|
57
|
-
unless level == ::Logger::INFO
|
58
|
-
event.merge! marker: File::basename(caller[4])
|
59
|
-
end
|
60
|
-
|
61
|
-
if colorize # console output
|
62
|
-
event = JSON::pretty_generate(event) + "\n"
|
63
|
-
event.colorize \
|
64
|
-
color: SEVERITY_COLORS[severity][0],
|
65
|
-
background: SEVERITY_COLORS[severity][1]
|
66
|
-
|
67
|
-
else # logging to file
|
68
|
-
event = JSON::generate(event) + "\n"
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|