Created
August 19, 2011 06:33
-
-
Save mongrelion/1156190 to your computer and use it in GitHub Desktop.
Log into a string var
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
io = StringIO.new | |
logger = Logger.new io | |
logger.info "foo" | |
io.string | |
=> "I, [2011-08-19T01:34:05.315739 #7354] INFO -- : foo\n" | |
logger.debug "bar" | |
io.string | |
=> "I, [2011-08-19T01:33:04.132831 #7354] INFO -- : foo\nD, [2011-08-19T01:33:08.836753 #7354] DEBUG -- : bar\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment