module Roma::Logging::RLogger::ExtShiftAge
Private Instance Methods
previous_period_end(now)
click to toggle source
# File lib/roma/logging/rlogger.rb 97 def previous_period_end(now) 98 ret = nil 99 case @shift_age 100 when /^min$/ 101 t = now - 1 * 60 102 ret = Time.mktime(t.year, t.month, t.mday, t.hour, t.min, 59) 103 when /^hour$/ 104 t = now - 1 * 60 * 60 105 ret = Time.mktime(t.year, t.month, t.mday, t.hour, 59, 59) 106 when /^daily$/ 107 ret = eod(now - 1 * SiD) 108 when /^weekly$/ 109 ret = eod(now - ((now.wday + 1) * SiD)) 110 when /^monthly$/ 111 ret = eod(now - now.mday * SiD) 112 else 113 ret = now 114 end 115 return ret 116 end
shift_log_period(now)
click to toggle source
# File lib/roma/logging/rlogger.rb 85 def shift_log_period(now) 86 postfix = previous_period_end(now).strftime("%Y%m%d%H%M") 87 age_file = "#{@filename}.#{postfix}" 88 if FileTest.exist?(age_file) 89 raise RuntimeError.new("'#{age_file}' already exists.") 90 end 91 @dev.close 92 File.rename(@filename, age_file) 93 @dev = create_logfile(@filename) 94 return true 95 end