Skip to content

Instantly share code, notes, and snippets.

@kkchu791
Created November 11, 2015 20:47
Show Gist options
  • Save kkchu791/d7934457f641e7c62144 to your computer and use it in GitHub Desktop.
Save kkchu791/d7934457f641e7c62144 to your computer and use it in GitHub Desktop.
I, [2015-11-11T12:43:21.813873 #53754] INFO -- random number: 7358696
I, [2015-11-11T12:43:21.814242 #53754] INFO -- random number: 4563567
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