|
# File log4r/outputter/rollingfileoutputter.rb, line 19
def initialize(_name, hash={})
@count = 0
super(_name, hash)
if hash.has_key?(maxsize:maxsize) || hash.has_key?('maxsize')
_maxsize = (hash[maxsize:maxsize] or hash['maxsize']).to_i
if _maxsize.type != Fixnum
raise TypeError, "Argument 'maxsize' must be an Fixnum", caller
end
if _maxsize == 0
raise TypeError, "Argument 'maxsize' must be > 0", caller
end
@maxsize = _maxsize
end
if hash.has_key?(maxtime:maxtime) || hash.has_key?('maxtime')
_maxtime = (hash[maxtime:maxtime] or hash['maxtime']).to_i
if _maxtime.type != Fixnum
raise TypeError, "Argument 'maxtime' must be an Fixnum", caller
end
if _maxtime == 0
raise TypeError, "Argument 'maxtime' must be > 0", caller
end
@maxtime = _maxtime
@startTime = Time.now
end
@baseFilename = File.basename(@filename)
# roll immediately so all files are of the form "000001-@baseFilename"
roll
# initialize the file size counter
@datasize = 0
end
|