If you wan to redirect your methods log to a file instead of console and after writing the log to the file the output should back to console then follow the below instructions.
you can change the type of writing to log file with replace of 'w', 'w+' etc.. depends on your requirements.
def example()
oldout=$stdout
$stdout=File.new("",'a')
.
.
.
.
.
$stdout=oldout
endyou can change the type of writing to log file with replace of 'w', 'w+' etc.. depends on your requirements.
No comments:
Post a Comment