class SmartProxyDynflowCore::Log
Public Class Methods
instance()
click to toggle source
# File lib/smart_proxy_dynflow_core/log.rb, line 9 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 17 def instance=(logger) @logger = logger end
log_file()
click to toggle source
# File lib/smart_proxy_dynflow_core/log.rb, line 34 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 26 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 43 def initialize(file, *rest) @file = file @fd = @file.kind_of?(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 21 def reload! @logger = nil instance end
Public Instance Methods
add(*args)
click to toggle source
Calls superclass method
# File lib/smart_proxy_dynflow_core/log.rb, line 50 def add(*args) handle_log_rolling if @roll_log super(*args) end
handle_log_rolling()
click to toggle source
# File lib/smart_proxy_dynflow_core/log.rb, line 59 def handle_log_rolling @roll_log = false unless @file.kind_of? IO @fd.reopen @file, 'a' @fd.sync = true end end
roll_log()
click to toggle source
# File lib/smart_proxy_dynflow_core/log.rb, line 55 def roll_log @roll_log = true end