gray_logger 0.11.4 → 0.11.5
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.
@@ -4,18 +4,28 @@ module GrayLogger
|
|
4
4
|
|
5
5
|
attr_accessor :host, :port, :size, :automatic_logging, :logger_level, :options
|
6
6
|
def initialize(configuration_hash)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
unless configuration_hash.nil?
|
8
|
+
configuration = configuration_hash.dup
|
9
|
+
defaults = {
|
10
|
+
:size => "WAN",
|
11
|
+
:facility => "facility-not-defined"
|
12
|
+
}
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
+
config = symbolize_keys(configuration)
|
15
|
+
config = defaults.merge(config)
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
+
[:host, :port, :size, :automatic_logging, :logger_level].each do |method|
|
18
|
+
send("#{method}=", config.delete(method))
|
19
|
+
end
|
20
|
+
self.options = config
|
17
21
|
end
|
18
|
-
|
22
|
+
end
|
23
|
+
|
24
|
+
def valid?
|
25
|
+
invalid_host = self.host.nil?
|
26
|
+
invalid_port = self.port.nil?
|
27
|
+
invalid_size = self.size.nil?
|
28
|
+
!(invalid_host || invalid_port || invalid_size)
|
19
29
|
end
|
20
30
|
|
21
31
|
def automatic_logging?
|
@@ -1,17 +1,13 @@
|
|
1
1
|
module GrayLogger
|
2
2
|
module HelperMethods
|
3
|
-
|
3
|
+
|
4
4
|
protected
|
5
5
|
def gray_logger_proxy
|
6
|
-
|
7
|
-
env["rack.gray_logger.proxy"]
|
8
|
-
else
|
9
|
-
request.env["rack.gray_logger.proxy"]
|
10
|
-
end
|
6
|
+
::GrayLogger.proxy
|
11
7
|
end
|
12
8
|
|
13
9
|
def gray_logger
|
14
|
-
|
10
|
+
::GrayLogger.proxy.gray_logger
|
15
11
|
end
|
16
12
|
|
17
13
|
end
|
data/lib/gray_logger/logger.rb
CHANGED
@@ -8,8 +8,12 @@ module GrayLogger
|
|
8
8
|
attr_reader :buckets, :configuration
|
9
9
|
|
10
10
|
def initialize(configuration)
|
11
|
-
|
12
|
-
|
11
|
+
if configuration.valid?
|
12
|
+
super(configuration.host, configuration.port, configuration.size, configuration.options)
|
13
|
+
@configuration = configuration
|
14
|
+
else
|
15
|
+
self.disable # from GELF
|
16
|
+
end
|
13
17
|
|
14
18
|
@buckets = {}
|
15
19
|
end
|
data/lib/gray_logger/proxy.rb
CHANGED
@@ -8,9 +8,7 @@ module GrayLogger
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def gray_logger
|
11
|
-
|
12
|
-
@gray_logger ||= ::GrayLogger::Logger.new(::GrayLogger.configuration.dup)
|
13
|
-
end
|
11
|
+
@gray_logger ||= ::GrayLogger::Logger.new(::GrayLogger.configuration)
|
14
12
|
end
|
15
13
|
|
16
14
|
# def debug(*args)
|
data/lib/gray_logger/rack.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gray_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 57
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 11
|
9
|
-
-
|
10
|
-
version: 0.11.
|
9
|
+
- 5
|
10
|
+
version: 0.11.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Benjamin Behr
|