#log_level added, rack-logger 3.2.9 -compatible
This commit is contained in:
parent
fd8860766b
commit
26853e31e2
|
@ -64,6 +64,11 @@ class Semlogger < ::Logger
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_accessor :logdev, :level, :progname
|
attr_accessor :logdev, :level, :progname
|
||||||
|
|
||||||
|
# some libs use #log_level
|
||||||
|
def log_level=( level) @level = level end
|
||||||
|
def log_level() @level end
|
||||||
|
|
||||||
class <<self
|
class <<self
|
||||||
attr_accessor :progname, :logger
|
attr_accessor :progname, :logger
|
||||||
|
|
||||||
|
@ -110,9 +115,7 @@ class Semlogger < ::Logger
|
||||||
|
|
||||||
def add severity, message = nil, progname = nil, &block
|
def add severity, message = nil, progname = nil, &block
|
||||||
severity ||= UNKNOWN
|
severity ||= UNKNOWN
|
||||||
if @logdev.nil? or severity < @level
|
return true if @logdev.nil? or severity < @level
|
||||||
return true
|
|
||||||
end
|
|
||||||
progname ||= @progname
|
progname ||= @progname
|
||||||
if message.nil?
|
if message.nil?
|
||||||
if block_given?
|
if block_given?
|
||||||
|
|
|
@ -4,10 +4,9 @@ class Semlogger::Rack < Rails::Rack::Logger
|
||||||
@data = data
|
@data = data
|
||||||
end
|
end
|
||||||
|
|
||||||
def call_app env
|
def call_app request, env
|
||||||
request = ActionDispatch::Request.new env
|
|
||||||
path = request.filtered_path
|
path = request.filtered_path
|
||||||
Rails.logger.info Semlogger.custom :connection, request.ip, Thread.current.object_id, request.request_method, path
|
Semlogger.custom( :connection, request.ip, Thread.current.object_id, request.request_method, path).info
|
||||||
@app.call env
|
@app.call env
|
||||||
ensure
|
ensure
|
||||||
ActiveSupport::LogSubscriber.flush_all!
|
ActiveSupport::LogSubscriber.flush_all!
|
||||||
|
|
Loading…
Reference in a new issue