提交 00236435 编写于 作者: K Karunakar (Ruby)

Moved all the logger methods to active support logger

minor
上级 f63fff6a
......@@ -206,7 +206,7 @@ A short rundown of some of the major features:
You specify a logger through a class method, such as:
ActionController::Base.logger = Logger.new("Application Log")
ActionController::Base.logger = ActiveSupport::Logger.new("Application Log")
ActionController::Base.logger = Log4r::Logger.new("Application Log")
......
......@@ -59,7 +59,7 @@ def setup
super
# enable a logger so that (e.g.) the benchmarking stuff runs, so we can get
# a more accurate simulation of what happens in "real life".
@controller.logger = Logger.new(nil)
@controller.logger = ActiveSupport::Logger.new(nil)
end
# :ported:
......
......@@ -85,7 +85,7 @@ class StreamingTest < Rack::TestCase
test "rendering with template exception logs the exception" do
io = StringIO.new
_old, ActionController::Base.logger = ActionController::Base.logger, Logger.new(io)
_old, ActionController::Base.logger = ActionController::Base.logger, ActiveSupport::Logger.new(io)
begin
get "/render_streaming/basic/template_exception"
......
......@@ -696,7 +696,7 @@ def setup
# enable a logger so that (e.g.) the benchmarking stuff runs, so we can get
# a more accurate simulation of what happens in "real life".
super
@controller.logger = Logger.new(nil)
@controller.logger = ActiveSupport::Logger.new(nil)
@request.host = "www.nextangle.com"
end
......@@ -907,7 +907,7 @@ def test_access_to_request_in_view
def test_access_to_logger_in_view
get :accessing_logger_in_template
assert_equal "Logger", @response.body
assert_equal "ActiveSupport::Logger", @response.body
end
# :ported:
......
......@@ -48,7 +48,7 @@ def setup
# enable a logger so that (e.g.) the benchmarking stuff runs, so we can get
# a more accurate simulation of what happens in "real life".
super
@controller.logger = Logger.new(nil)
@controller.logger = ActiveSupport::Logger.new(nil)
@request.host = "www.nextangle.com"
end
......
......@@ -34,7 +34,7 @@ def teardown
with_test_routing do
output = StringIO.new
json = "[\"person]\": {\"name\": \"David\"}}"
post "/parse", json, {'CONTENT_TYPE' => 'application/json', 'action_dispatch.show_exceptions' => true, 'action_dispatch.logger' => Logger.new(output)}
post "/parse", json, {'CONTENT_TYPE' => 'application/json', 'action_dispatch.show_exceptions' => true, 'action_dispatch.logger' => ActiveSupport::Logger.new(output)}
assert_response :error
output.rewind && err = output.read
assert err =~ /Error occurred while parsing request parameters/
......
......@@ -56,7 +56,7 @@ def call(env)
with_test_routing do
output = StringIO.new
xml = "<person><name>David</name><avatar type='file' name='me.jpg' content_type='image/jpg'>#{::Base64.encode64('ABC')}</avatar></pineapple>"
post "/parse", xml, default_headers.merge('action_dispatch.show_exceptions' => true, 'action_dispatch.logger' => Logger.new(output))
post "/parse", xml, default_headers.merge('action_dispatch.show_exceptions' => true, 'action_dispatch.logger' => ActiveSupport::Logger.new(output))
assert_response :error
output.rewind && err = output.read
assert err =~ /Error occurred while parsing request parameters/
......
......@@ -37,7 +37,7 @@ def lookup_context
end
def logger
Logger.new(STDERR)
ActiveSupport::Logger.new(STDERR)
end
def my_buffer
......
......@@ -143,7 +143,7 @@ A short rundown of some of the major features:
* Logging support for Log4r[http://log4r.sourceforge.net] and Logger[http://www.ruby-doc.org/stdlib/libdoc/logger/rdoc].
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDOUT)
ActiveRecord::Base.logger = Log4r::Logger.new("Application Log")
......
......@@ -38,7 +38,7 @@ class Railtie < Rails::Railtie
# first time. Also, make it output to STDERR.
console do |app|
require "active_record/railties/console_sandbox" if app.sandbox?
ActiveRecord::Base.logger = Logger.new(STDERR)
ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDERR)
end
initializer "active_record.initialize_timezone" do
......
......@@ -7,11 +7,10 @@
require 'active_resource'
require 'active_support'
require 'active_support/test_case'
require 'setter_trap'
require 'active_support/logger'
require 'logger'
ActiveResource::Base.logger = Logger.new("#{File.dirname(__FILE__)}/debug.log")
ActiveResource::Base.logger = ActiveSupport::Logger.new("#{File.dirname(__FILE__)}/debug.log")
def setup_response
matz_hash = { 'person' => { :id => 1, :name => 'Matz' } }
......
......@@ -3,7 +3,6 @@
require 'stringio'
require 'fileutils'
require 'tempfile'
require 'active_support/buffered_logger'
require 'active_support/testing/deprecation'
class BufferedLoggerTest < Test::Unit::TestCase
......
......@@ -681,7 +681,7 @@ def setup
@data = @cache.instance_variable_get(:@data)
@cache.clear
@cache.silence!
@cache.logger = Logger.new("/dev/null")
@cache.logger = ActiveSupport::Logger.new("/dev/null")
end
include CacheStoreBehavior
......@@ -786,7 +786,7 @@ def setup
@cache = ActiveSupport::Cache.lookup_store(:memory_store)
@buffer = StringIO.new
@cache.logger = Logger.new(@buffer)
@cache.logger = ActiveSupport::Logger.new(@buffer)
end
def test_logging
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册