class Flor::Logger::FileOut
Public Class Methods
new(unit, dir)
click to toggle source
Calls superclass method
Flor::Logger::Out::new
# File lib/flor/unit/logger.rb, line 301 def initialize(unit, dir) super(unit) @dir = dir @mutex = Mutex.new @file = nil @fname = nil end
Public Instance Methods
close()
click to toggle source
# File lib/flor/unit/logger.rb, line 312 def close; @mutex.synchronize { @file.close if @file }; end
flush()
click to toggle source
# File lib/flor/unit/logger.rb, line 311 def flush; @mutex.synchronize { @file.flush if @file }; end
puts(s)
click to toggle source
# File lib/flor/unit/logger.rb, line 314 def puts(s) @mutex.synchronize { prepare_file.puts(s) } end
Protected Instance Methods
prepare_file()
click to toggle source
# File lib/flor/unit/logger.rb, line 320 def prepare_file fn = File.join( @dir, "#{@unit.env}_#{Time.now.strftime('%Y-%m-%d')}.log") if fn != @fname @file.close if @file @file = nil @fname = fn end @file ||= File.open(@fname, 'ab:UTF-8') end