Class: Sappho::ApplicationAutoFlushLog

Inherits:
AutoFlushLog show all
Includes:
Singleton
Defined in:
lib/sappho-basics/auto_flush_log.rb

Constant Summary collapse

@@file =
nil

Constants inherited from AutoFlushLog

Sappho::AutoFlushLog::LOG_DETAIL, Sappho::AutoFlushLog::LOG_LEVELS

Instance Method Summary collapse

Methods inherited from AutoFlushLog

#debug, #debug?, #error, #fatal, file, #info, #warn

Constructor Details

#initializeApplicationAutoFlushLog

Returns a new instance of ApplicationAutoFlushLog.



86
87
88
89
90
91
92
93
# File 'lib/sappho-basics/auto_flush_log.rb', line 86

def initialize
  unless @@file
    filename = ENV['application.log.filename']
    mode = File.exists?(filename) ? 'a' : 'w' if filename
    @@file = filename ? File.open(filename, mode) : $stdout
  end
  super @@file, ENV['application.log.level'], ENV['application.log.detail']
end