Class: Bluepill::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/bluepill/logger.rb

Defined Under Namespace

Classes: LoggerAdapter

Constant Summary collapse

LOG_METHODS =
[:emerg, :alert, :crit, :err, :warning, :notice, :info, :debug]

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Logger

Returns a new instance of Logger.



6
7
8
9
10
11
12
# File 'lib/bluepill/logger.rb', line 6

def initialize(options = {})
  @options  = options
  @logger   = options[:logger] || self.create_logger
  @prefix   = options[:prefix]
  @stdout   = options[:stdout]
  @prefixes = {}
end

Instance Method Details

#prefix_with(prefix) ⇒ Object



31
32
33
# File 'lib/bluepill/logger.rb', line 31

def prefix_with(prefix)
  @prefixes[prefix] ||= self.class.new(:logger => self, :prefix => prefix)
end

#reopenObject



35
36
37
38
39
40
41
# File 'lib/bluepill/logger.rb', line 35

def reopen
  if @logger.is_a?(self.class)
    @logger.reopen
  else
    @logger = create_logger
  end
end