Class: Envo::Logger
- Inherits:
-
Object
- Object
- Envo::Logger
- Defined in:
- lib/envo/logger.rb
Constant Summary collapse
- ERROR =
0- WARN =
1- INFO =
2- DEBUG =
3
Instance Attribute Summary collapse
-
#max_level ⇒ Object
Returns the value of attribute max_level.
Instance Method Summary collapse
- #debug(text) ⇒ Object
- #error(text) ⇒ Object
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
- #log(level, text) ⇒ Object
- #plog(level, text) ⇒ Object
- #print(text) ⇒ Object
- #puts(text) ⇒ Object
- #warn(text) ⇒ Object
Constructor Details
Instance Attribute Details
#max_level ⇒ Object
Returns the value of attribute max_level.
10 11 12 |
# File 'lib/envo/logger.rb', line 10 def max_level @max_level end |
Instance Method Details
#debug(text) ⇒ Object
25 |
# File 'lib/envo/logger.rb', line 25 def debug(text); log(DEBUG, text); end |
#error(text) ⇒ Object
21 |
# File 'lib/envo/logger.rb', line 21 def error(text); log(ERROR, text); end |
#log(level, text) ⇒ Object
11 12 13 14 15 |
# File 'lib/envo/logger.rb', line 11 def log(level, text) return if level > max_level stream = level == 0 ? STDERR : STDOUT stream.puts(text) end |
#plog(level, text) ⇒ Object
16 17 18 19 20 |
# File 'lib/envo/logger.rb', line 16 def plog(level, text) return if level > max_level stream = level == 0 ? STDERR : STDOUT stream.print(text) end |
#print(text) ⇒ Object
24 |
# File 'lib/envo/logger.rb', line 24 def print(text); plog(INFO, text); end |
#puts(text) ⇒ Object
23 |
# File 'lib/envo/logger.rb', line 23 def puts(text); log(INFO, text); end |
#warn(text) ⇒ Object
22 |
# File 'lib/envo/logger.rb', line 22 def warn(text); log(WARN, text); end |