Class: Slackware::Log

Inherits:
Logger
  • Object
show all
Includes:
Singleton
Defined in:
lib/slackware/log.rb

Overview

Log is a subclass of Logger, but is implemented as a singleton, so it can be used across library in a somewhat unified manner. Example:

require 'slackware/log'

slog = Slackware::Log.instance
slog.info("LOG ALL THE THINGS!")
slog.debug('my_app') { ex.backtrace }

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Log

Since Singleton does a lazy loader, this will not get initialized until it is first used. So it’ll be nil, or you can set $logdev early on. It defaults to WARN level and STDERR



43
44
45
46
47
48
49
# File 'lib/slackware/log.rb', line 43

def initialize(*args)
  if $logdev
	super($logdev, args)
  else
	super(STDERR, args)
  end
end