Class: Monad::Logger
- Inherits:
-
Logger
- Object
- Logger
- Monad::Logger
- Defined in:
- lib/monad/logger.rb
Class Method Summary collapse
-
.error(topic, message) ⇒ Object
Public: Print a monad error message to stderr.
-
.formatted_topic(topic) ⇒ Object
Public: Format the topic.
-
.info(topic, message) ⇒ Object
Public: Print a monad message to stdout.
-
.message(topic, message) ⇒ Object
Public: Build a Monad topic method.
-
.warn(topic, message) ⇒ Object
Public: Print a monad message to stderr.
Class Method Details
.error(topic, message) ⇒ Object
Public: Print a monad error message to stderr
topic - the topic of the message, e.g. “Configuration file”, “Deprecation”, etc. message - the message detail
Returns nothing
31 32 33 |
# File 'lib/monad/logger.rb', line 31 def self.error(topic, ) $stderr.puts (topic, ).red end |
.formatted_topic(topic) ⇒ Object
Public: Format the topic
topic - the topic of the message, e.g. “Configuration file”, “Deprecation”, etc.
Returns the formatted topic statement
50 51 52 |
# File 'lib/monad/logger.rb', line 50 def self.formatted_topic(topic) "#{topic} ".rjust(20) end |
.info(topic, message) ⇒ Object
Public: Print a monad message to stdout
topic - the topic of the message, e.g. “Configuration file”, “Deprecation”, etc. message - the message detail
Returns nothing
11 12 13 |
# File 'lib/monad/logger.rb', line 11 def self.info(topic, ) $stdout.puts (topic, ) end |
.message(topic, message) ⇒ Object
Public: Build a Monad topic method
topic - the topic of the message, e.g. “Configuration file”, “Deprecation”, etc. message - the message detail
Returns the formatted message
41 42 43 |
# File 'lib/monad/logger.rb', line 41 def self.(topic, ) formatted_topic(topic) + .gsub(/\s+/, ' ') end |
.warn(topic, message) ⇒ Object
Public: Print a monad message to stderr
topic - the topic of the message, e.g. “Configuration file”, “Deprecation”, etc. message - the message detail
Returns nothing
21 22 23 |
# File 'lib/monad/logger.rb', line 21 def self.warn(topic, ) $stderr.puts (topic, ).yellow end |