Class: StringLogger
- Inherits:
-
Object
- Object
- StringLogger
- Defined in:
- lib/string_logger.rb
Overview
Logs to a string. This is useful in testing so that we can read back what was put into the log, to see if it was what was expected.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(*params) ⇒ StringLogger
constructor
A new instance of StringLogger.
- #puts(msg) ⇒ Object (also: #debug, #info, #notice, #warning, #err, #alert, #emerg, #crit)
- #string ⇒ Object
Constructor Details
#initialize(*params) ⇒ StringLogger
5 6 7 |
# File 'lib/string_logger.rb', line 5 def initialize(*params) @log = StringIO.new("", "w") end |
Instance Method Details
#close ⇒ Object
8 9 |
# File 'lib/string_logger.rb', line 8 def close end |
#puts(msg) ⇒ Object Also known as: debug, info, notice, warning, err, alert, emerg, crit
11 12 13 |
# File 'lib/string_logger.rb', line 11 def puts(msg) @log.puts(msg) end |
#string ⇒ Object
15 16 17 |
# File 'lib/string_logger.rb', line 15 def string @log.string end |