Class: TorqueBox::FallbackLogger

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

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (FallbackLogger) initialize(name = nil)

Returns a new instance of FallbackLogger



27
28
29
30
31
# File 'core/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

- (Object) :formatter

Returns the value of attribute :formatter



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

def :formatter
  @:formatter
end

Instance Method Details

- (Object) add(severity, message, progname, &block)



33
34
35
36
37
38
39
40
# File 'core/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

- (Object) flush



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

def flush
end

- (Object) puts(message)



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

def puts(message)
  info message.to_s
end

- (Object) write(message)



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

def write(message)
  info message.strip
end