gray_logger 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -26,7 +26,7 @@ GrayLogger is a small logging tool that allows you to simply log anything you wa
26
26
  require 'gray_logger'
27
27
  begin
28
28
  gray_logger_config = YAML.load(File.read(Rails.root.join("config/gray_logger.yml")))[Rails.env]
29
- Rails.configuration.middleware.insert_after Rack::Lock, "GrayLogger::Middleware", :configuration => gray_logger_config
29
+ Rails.configuration.middleware.insert_after Rack::Lock, "Rack::GrayLogger::Middleware", :configuration => gray_logger_config
30
30
  rescue => e
31
31
  $stderr.puts("GrayLogger not configured. Please add config/gray_logger.yml")
32
32
  end
@@ -36,7 +36,8 @@ GrayLogger is a small logging tool that allows you to simply log anything you wa
36
36
 
37
37
  4. To install the gray_logger proxy:
38
38
  ````ruby
39
- config.logger = Rack::GrayLogger::Proxy.new(Syslogger.new("path..."))
39
+ Rack::GrayLogger.proxy.proxied_logger = Syslogger.new("path...")
40
+ config.logger = Rack::GrayLogger.proxy
40
41
  ````
41
42
 
42
43
  ## Usage
data/lib/gray_logger.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'singleton'
2
1
  require 'gelf'
3
2
 
4
3
  require 'gray_logger/support'
@@ -47,6 +47,7 @@ module GrayLogger
47
47
  @buckets.keys.each do |bucket_name|
48
48
  flush_bucket(bucket_name)
49
49
  end
50
+ reset!
50
51
  end
51
52
 
52
53
  # flush a specific bucket
@@ -11,7 +11,7 @@ module Rack
11
11
  configuration = symbolize_keys(options.delete(:configuration))
12
12
  self.gray_logger = ::GrayLogger::Logger.new(configuration)
13
13
 
14
- ::Rack::GrayLogger.proxy.gray_logger = gray_logger if ::Rack::GrayLogger.proxy
14
+ ::Rack::GrayLogger.proxy.gray_logger = gray_logger
15
15
  end
16
16
 
17
17
  def call(env)
@@ -66,6 +66,7 @@ module Rack
66
66
  end
67
67
  EOT
68
68
  end
69
+
69
70
  private
70
71
  def method_missing(method_name, *args, &block)
71
72
  unless gray_logger.nil?
@@ -83,13 +84,6 @@ module Rack
83
84
  end
84
85
  end
85
86
  end
86
-
87
- end
88
-
89
- # config.logger = Rack::GrayLogger.after_request_proxy(SysLogger.new)
90
- def self.after_request_proxy(proxied_logger)
91
- self.proxy = Rack::GrayLogger::Proxy.new(:proxied_logger => proxied_logger)
92
- proxy
93
87
  end
94
88
 
95
89
  def self.proxy= proxy
@@ -97,7 +91,7 @@ module Rack
97
91
  end
98
92
 
99
93
  def self.proxy
100
- @proxy
94
+ @proxy ||= ::Rack::GrayLogger::Proxy.new
101
95
  end
102
96
 
103
97
  end
@@ -13,7 +13,7 @@ module GrayLogger
13
13
  # Overrides the rescue_action method in ActionController::Base, but does not inhibit
14
14
  # any custom processing that is defined with Rails 2's exception helpers.
15
15
  def rescue_action_with_gray_logger(exception)
16
- gray_logger.handle_exception(exception)
16
+ gray_logger.log_exception(exception)
17
17
  rescue_action_without_gray_logger(exception)
18
18
  end
19
19
  end
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: 55
4
+ hash: 51
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 10
8
+ - 11
9
9
  - 0
10
- version: 0.10.0
10
+ version: 0.11.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Benjamin Behr