Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
39475aa3
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
39475aa3
编写于
7月 02, 2013
作者:
C
Carlos Antonio da Silva
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove deprecated Logger core extensions (core_ext/logger.rb)
上级
c1e649a3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
4 addition
and
68 deletion
+4
-68
activesupport/CHANGELOG.md
activesupport/CHANGELOG.md
+4
-0
activesupport/lib/active_support/core_ext.rb
activesupport/lib/active_support/core_ext.rb
+0
-1
activesupport/lib/active_support/core_ext/logger.rb
activesupport/lib/active_support/core_ext/logger.rb
+0
-67
未找到文件。
activesupport/CHANGELOG.md
浏览文件 @
39475aa3
*
Remove deprecated
`Logger`
core extensions (
`core_ext/logger.rb`
).
*Carlos Antonio da Silva*
*
Remove deprecated
`Time#time_with_datetime_fallback`
,
`Time#utc_time`
and
`Time#local_time`
in favor of
`Time#utc`
and
`Time#local`
.
...
...
activesupport/lib/active_support/core_ext.rb
浏览文件 @
39475aa3
Dir
[
"
#{
File
.
dirname
(
__FILE__
)
}
/core_ext/*.rb"
].
each
do
|
path
|
next
if
File
.
basename
(
path
,
'.rb'
)
==
'logger'
require
path
end
activesupport/lib/active_support/core_ext/logger.rb
已删除
100644 → 0
浏览文件 @
c1e649a3
require
'active_support/core_ext/class/attribute_accessors'
require
'active_support/deprecation'
require
'active_support/logger_silence'
ActiveSupport
::
Deprecation
.
warn
'this file is deprecated and will be removed'
# Adds the 'around_level' method to Logger.
class
Logger
#:nodoc:
def
self
.
define_around_helper
(
level
)
module_eval
<<-
end_eval
,
__FILE__
,
__LINE__
+
1
def around_
#{
level
}
(before_message, after_message) # def around_debug(before_message, after_message, &block)
self.
#{
level
}
(before_message) # self.debug(before_message)
return_value = yield(self) # return_value = yield(self)
self.
#{
level
}
(after_message) # self.debug(after_message)
return_value # return_value
end # end
end_eval
end
[
:debug
,
:info
,
:error
,
:fatal
].
each
{
|
level
|
define_around_helper
(
level
)
}
end
require
'logger'
# Extensions to the built-in Ruby logger.
#
# If you want to use the default log formatter as defined in the Ruby core, then you
# will need to set the formatter for the logger as in:
#
# logger.formatter = Formatter.new
#
# You can then specify the datetime format, for example:
#
# logger.datetime_format = "%Y-%m-%d"
#
# Note: This logger is deprecated in favor of ActiveSupport::Logger
class
Logger
include
LoggerSilence
alias
:old_datetime_format
=
:datetime_format
=
# Logging date-time format (string passed to +strftime+). Ignored if the formatter
# does not respond to datetime_format=.
def
datetime_format
=
(
format
)
formatter
.
datetime_format
=
format
if
formatter
.
respond_to?
(
:datetime_format
=
)
end
alias
:old_datetime_format
:datetime_format
# Get the logging datetime format. Returns nil if the formatter does not support
# datetime formatting.
def
datetime_format
formatter
.
datetime_format
if
formatter
.
respond_to?
(
:datetime_format
)
end
alias
:old_initialize
:initialize
# Overwrite initialize to set a default formatter.
def
initialize
(
*
args
)
old_initialize
(
*
args
)
self
.
formatter
=
SimpleFormatter
.
new
end
# Simple formatter which only displays the message.
class
SimpleFormatter
<
Logger
::
Formatter
# This method is invoked when a log event occurs
def
call
(
severity
,
timestamp
,
progname
,
msg
)
"
#{
String
===
msg
?
msg
:
msg
.
inspect
}
\n
"
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录