Class: SeaShanty::Logger
- Inherits:
-
Object
- Object
- SeaShanty::Logger
- Defined in:
- lib/sea_shanty/util/logger.rb
Defined Under Namespace
Classes: NullLogger
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
Instance Method Summary collapse
-
#initialize(destination) ⇒ Logger
constructor
A new instance of Logger.
- #log(message) ⇒ Object
Constructor Details
#initialize(destination) ⇒ Logger
7 8 9 10 11 12 13 |
# File 'lib/sea_shanty/util/logger.rb', line 7 def initialize(destination) @destination = if destination.respond_to? :printf destination else File.open(destination.to_s, "a+") end end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
5 6 7 |
# File 'lib/sea_shanty/util/logger.rb', line 5 def destination @destination end |
Instance Method Details
#log(message) ⇒ Object
15 16 17 18 |
# File 'lib/sea_shanty/util/logger.rb', line 15 def log() destination.write() destination.write("\n") unless .end_with?("\n") end |