class SmartProxyDynflowCore::Log
Public Class Methods
instance()
click to toggle source
# File lib/smart_proxy_dynflow_core/log.rb, line 8 def instance if @logger.nil? @logger = self.new log_file @logger.level = log_level end @logger end
instance=(logger)
click to toggle source
# File lib/smart_proxy_dynflow_core/log.rb, line 16 def instance=(logger) @logger = logger end
log_file()
click to toggle source
# File lib/smart_proxy_dynflow_core/log.rb, line 33 def log_file if Settings.instance.loaded && Settings.instance.log_file Settings.instance.log_file else $stdout end end
log_level()
click to toggle source
# File lib/smart_proxy_dynflow_core/log.rb, line 25 def log_level if Settings.instance.loaded && Settings.instance.log_level ::Logger.const_get(Settings.instance.log_level.upcase) else Logger::WARN end end
new(file, *rest)
click to toggle source
Calls superclass method
# File lib/smart_proxy_dynflow_core/log.rb, line 42 def initialize(file, *rest) @file = file @fd = @file.is_a?(IO) ? @file : File.open(@file, 'a') @fd.sync = true super(@fd, rest) end
reload!()
click to toggle source
# File lib/smart_proxy_dynflow_core/log.rb, line 20 def reload! @logger = nil instance end
Public Instance Methods
roll_log()
click to toggle source
# File lib/smart_proxy_dynflow_core/log.rb, line 49 def roll_log unless @file.is_a? IO @fd.reopen @file, 'a' @fd.sync = true end end