Class: MyUtilities::Logger
- Inherits:
-
Object
- Object
- MyUtilities::Logger
- Defined in:
- lib/my_utilities.rb
Constant Summary collapse
- DEBUG =
4
- INFO =
3
- WARN =
2
- ERROR =
1
- FATAL =
0
Instance Method Summary collapse
- #debug(mesg) ⇒ Object
- #fatal(mesg) ⇒ Object
-
#initialize(level = FATAL) ⇒ Logger
constructor
A new instance of Logger.
- #puts(mesg, level = DEBUG) ⇒ Object
Constructor Details
#initialize(level = FATAL) ⇒ Logger
Returns a new instance of Logger.
70 71 72 |
# File 'lib/my_utilities.rb', line 70 def initialize(level=FATAL) @mesg_level = level.to_i end |
Instance Method Details
#debug(mesg) ⇒ Object
74 75 76 |
# File 'lib/my_utilities.rb', line 74 def debug(mesg) self.puts mesg, DEBUG end |
#fatal(mesg) ⇒ Object
78 79 80 |
# File 'lib/my_utilities.rb', line 78 def fatal(mesg) self.puts mesg, FATAL end |
#puts(mesg, level = DEBUG) ⇒ Object
82 83 84 85 86 |
# File 'lib/my_utilities.rb', line 82 def puts(mesg, level=DEBUG) if @mesg_level >= level super mesg end end |