module Roma::Logging::RLogger::ExtShiftAge
Private Instance Methods
previous_period_end(now)
click to toggle source
# File lib/roma/client/rlogger.rb 46 def previous_period_end(now) 47 ret = nil 48 case @shift_age 49 when /^min$/ 50 t = now - 1 * 60 51 ret = Time.mktime(t.year, t.month, t.mday, t.hour, t.min, 59) 52 when /^hour$/ 53 t = now - 1 * 60 * 60 54 ret = Time.mktime(t.year, t.month, t.mday, t.hour, 59, 59) 55 when /^daily$/ 56 ret = eod(now - 1 * SiD) 57 when /^weekly$/ 58 ret = eod(now - ((now.wday + 1) * SiD)) 59 when /^monthly$/ 60 ret = eod(now - now.mday * SiD) 61 else 62 ret = now 63 end 64 return ret 65 end
shift_log_period(now)
click to toggle source
# File lib/roma/client/rlogger.rb 34 def shift_log_period(now) 35 postfix = previous_period_end(now).strftime("%Y%m%d%H%M") 36 age_file = "#{@filename}.#{postfix}" 37 if FileTest.exist?(age_file) 38 raise RuntimeError.new("'#{age_file}' already exists.") 39 end 40 @dev.close 41 File.rename(@filename, age_file) 42 @dev = create_logfile(@filename) 43 return true 44 end