Class: Sh::Log

Inherits:
Object show all
Defined in:
lib/sh_log.rb

Defined Under Namespace

Classes: Broadcaster

Constant Summary collapse

LEVELS =
[:debug, :info, :warning, :error]
@@output_streams =
[]
@@stdout =
$stdout
@@stderr =
$stderr

Class Method Summary collapse

Class Method Details

.add_output_stream(stream, level = :debug) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/sh_log.rb', line 36

def self.add_output_stream stream, level=:debug
	case stream
	when :stdout
		stream = @@stdout
	when :stderr
		stream = @@stderr
	end
	@@output_streams << [stream, level]
end

.debug(message, error = nil) ⇒ Object



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

def self.debug(message, error=nil)
	log message, :debug, error
end

.error(message, error = nil) ⇒ Object



58
59
60
# File 'lib/sh_log.rb', line 58

def self.error(message, error=nil)
	log message, :error, error
end

.info(message, error = nil) ⇒ Object



50
51
52
# File 'lib/sh_log.rb', line 50

def self.info(message, error=nil)
	log message, :info, error
end

.warning(message, error = nil) ⇒ Object



54
55
56
# File 'lib/sh_log.rb', line 54

def self.warning(message, error=nil)
	log message, :warning, error
end