Class: Pbin::Logger
- Inherits:
-
Object
- Object
- Pbin::Logger
- Defined in:
- lib/pbin/logger.rb
Constant Summary collapse
- INFO_PREFIX =
'[>]'
- WARNING_PREFIX =
'[!]'
- ERROR_PREFIX =
'[x]'
Instance Method Summary collapse
- #error(text) ⇒ Object
- #info(text) ⇒ Object
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
- #now ⇒ Object
- #warning(text) ⇒ Object
Constructor Details
Instance Method Details
#error(text) ⇒ Object
26 27 28 |
# File 'lib/pbin/logger.rb', line 26 def error(text) "#{now} #{ERROR_PREFIX} #{error}" end |
#info(text) ⇒ Object
18 19 20 |
# File 'lib/pbin/logger.rb', line 18 def info(text) "#{now} #{INFO_PREFIX} #{text}" end |
#now ⇒ Object
14 15 16 |
# File 'lib/pbin/logger.rb', line 14 def now "#{Time.now.strftime("[%Y-%m-%d %H:%M:%S]")}" end |
#warning(text) ⇒ Object
22 23 24 |
# File 'lib/pbin/logger.rb', line 22 def warning(text) "#{now} #{WARNING_PREFIX} #{error}" end |