Created
November 11, 2015 20:47
-
-
Save kkchu791/d7934457f641e7c62144 to your computer and use it in GitHub Desktop.
This file contains 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
I, [2015-11-11T12:43:21.813873 #53754] INFO -- random number: 7358696 | |
I, [2015-11-11T12:43:21.814242 #53754] INFO -- random number: 4563567 |
This file contains 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
require 'logger' | |
class Charlie | |
def random_number | |
rand(10000000) | |
end | |
end | |
c = Charlie.new | |
p rand1 = c.random_number | |
p rand2 = c.random_number | |
logger = Logger.new('./logfile.txt') | |
logger.info('random number #1') { rand1 } | |
logger.info('random number #2') { rand2 } | |
logger.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment