diff options
author | jessib <jessib@riseup.net> | 2013-09-30 11:02:35 -0700 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2013-09-30 11:02:35 -0700 |
commit | 7b2b5472ffc306fff2cdd49cf8415a035093eb5d (patch) | |
tree | f556e921c1211b1b55f4eeefeef08c11920684cf /lib/tapicero/couch_changes.rb | |
parent | 83c323fbe10249a54d6383189fd9279d82c7d010 (diff) | |
parent | 27ad1b6d833213cf50edb1d3dab60abe243be123 (diff) |
Merge pull request #1 from azul/feature/logging
log to file or syslog instead of STDOUT
Diffstat (limited to 'lib/tapicero/couch_changes.rb')
-rw-r--r-- | lib/tapicero/couch_changes.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/tapicero/couch_changes.rb b/lib/tapicero/couch_changes.rb index 55a5489..376eb11 100644 --- a/lib/tapicero/couch_changes.rb +++ b/lib/tapicero/couch_changes.rb @@ -21,8 +21,8 @@ module Tapicero end def listen - puts "listening..." - puts "Starting at sequence #{since}" + Tapicero.logger.info "listening..." + Tapicero.logger.debug "Starting at sequence #{since}" db.changes :feed => :continuous, :since => since, :heartbeat => 1000 do |hash| callbacks(hash) end @@ -44,13 +44,14 @@ module Tapicero end def read_seq(seq_filename) + Tapicero.logger.debug "Looking up sequence here: #{seq_filename}" FileUtils.touch(seq_filename) unless File.writable?(seq_filename) raise StandardError.new("Can't access sequence file") end @since = File.read(seq_filename) rescue Errno::ENOENT => e - puts "No sequence file found. Starting from scratch" + Tapicero.logger.warn "No sequence file found. Starting from scratch" end def store_seq(seq) @@ -62,7 +63,7 @@ module Tapicero # def fetch_last_seq hash = db.changes :limit => 1, :descending => true - puts "starting at seq: " + hash["last_seq"] + Tapicero.logger.info "starting at seq: " + hash["last_seq"] return hash["last_seq"] end |