Class: TorqueBox::FallbackLogger Private

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

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil) ⇒ FallbackLogger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FallbackLogger.



27
28
29
30
31
# File 'lib/torquebox/logger.rb', line 27

def initialize name = nil
  super(ENV['TORQUEBOX_FALLBACK_LOGFILE'] || $stderr)
  @category = name || (TORQUEBOX_APP_NAME if defined? TORQUEBOX_APP_NAME) || "TorqueBox"
  @formatter = ::Logger::Formatter.new
end

Instance Attribute Details

#formatterObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/torquebox/logger.rb', line 25

def formatter
  @formatter
end

Instance Method Details

#add(severity, message, progname, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
36
37
38
39
40
# File 'lib/torquebox/logger.rb', line 33

def add(severity, message, progname, &block)
  if ( message.nil? && block.nil? )
    message = progname
    progname = @category
  end
  message = progname if message.nil?
  super( severity, message, @category, &block )
end

#flushObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



49
50
# File 'lib/torquebox/logger.rb', line 49

def flush
end

#puts(message) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Allow our logger to be used for env



43
44
45
# File 'lib/torquebox/logger.rb', line 43

def puts(message)
  info message.to_s
end

#write(message) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



46
47
48
# File 'lib/torquebox/logger.rb', line 46

def write(message)
  info message.strip
end