添加注释
This commit is contained in:
parent
79fd7ebd7a
commit
ae74dff89b
|
@ -195,6 +195,7 @@ require 'fileutils'
|
||||||
# # e.g. "Thu Sep 22 08:51:08 GMT+9:00 2005: hello world"
|
# # e.g. "Thu Sep 22 08:51:08 GMT+9:00 2005: hello world"
|
||||||
#
|
#
|
||||||
class Logger
|
class Logger
|
||||||
|
#具体内容请看https://bugs.ruby-lang.org/issues/7303
|
||||||
# Device used for logging messages.
|
# Device used for logging messages.
|
||||||
class LogDevice
|
class LogDevice
|
||||||
def shift_log_period(period_end)
|
def shift_log_period(period_end)
|
||||||
|
@ -213,11 +214,12 @@ class Logger
|
||||||
# @dev.close rescue nil
|
# @dev.close rescue nil
|
||||||
# File.rename("#{@filename}", age_file)
|
# File.rename("#{@filename}", age_file)
|
||||||
# @dev = create_logfile(@filename)
|
# @dev = create_logfile(@filename)
|
||||||
|
#覆盖原来lib库的方法,将上边三行删除,增加下边两行
|
||||||
FileUtils.cp(@filename, age_file)
|
FileUtils.cp(@filename, age_file)
|
||||||
reset_logfile(@dev) # see below for this new method return true
|
reset_logfile(@dev) # see below for this new method return true
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
#打开原来lib库,新增一个方法
|
||||||
def reset_logfile(logdev)
|
def reset_logfile(logdev)
|
||||||
logdev.truncate( 0 )
|
logdev.truncate( 0 )
|
||||||
logdev.sync = true
|
logdev.sync = true
|
||||||
|
|
Loading…
Reference in New Issue