Class: Toolshed::Logger
- Inherits:
-
Object
- Object
- Toolshed::Logger
- Includes:
- Singleton, Term::ANSIColor
- Defined in:
- lib/toolshed/logger.rb
Instance Attribute Summary collapse
-
#loggers ⇒ Object
Returns the value of attribute loggers.
Class Method Summary collapse
Instance Method Summary collapse
- #add_log_source(source) ⇒ Object
- #debug(message) ⇒ Object
- #fatal(message) ⇒ Object
- #info(message) ⇒ Object
- #warn(message) ⇒ Object
Instance Attribute Details
#loggers ⇒ Object
Returns the value of attribute loggers.
9 10 11 |
# File 'lib/toolshed/logger.rb', line 9 def loggers @loggers end |
Class Method Details
.create(options = {}) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/toolshed/logger.rb', line 11 def self.create( = {}) instance.loggers = [] log_sources = [:log_sources] || [STDOUT] log_sources.each do |log_source| instance.loggers << Logger.new(log_source) end end |
Instance Method Details
#add_log_source(source) ⇒ Object
19 20 21 |
# File 'lib/toolshed/logger.rb', line 19 def add_log_source(source) loggers << Logger.new(source) end |
#debug(message) ⇒ Object
23 24 25 26 27 |
# File 'lib/toolshed/logger.rb', line 23 def debug() loggers.each do |logger| logger.debug() end end |
#fatal(message) ⇒ Object
29 30 31 32 33 |
# File 'lib/toolshed/logger.rb', line 29 def fatal() loggers.each do |logger| logger.info(red()) end end |
#info(message) ⇒ Object
35 36 37 38 39 |
# File 'lib/toolshed/logger.rb', line 35 def info() loggers.each do |logger| logger.info(green()) end end |
#warn(message) ⇒ Object
41 42 43 44 45 |
# File 'lib/toolshed/logger.rb', line 41 def warn() loggers.each do |logger| logger.warn(yellow()) end end |