Skip to content

Instantly share code, notes, and snippets.

@hdemon
Last active December 31, 2015 14:49
Show Gist options
  • Select an option

  • Save hdemon/8002780 to your computer and use it in GitHub Desktop.

Select an option

Save hdemon/8002780 to your computer and use it in GitHub Desktop.
require 'logger'
# see http://twei55.github.io/blog/2012/01/26/ruby-singleton-logger/
class Log
include Singleton
attr_reader :logger
LOG_FILE = File.open("/var/log/crawler.log", "a")
def initialize
@logger = Logger.new LOG_FILE
end
def self.logger
return Log.instance.logger
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment