lib/rami.rb in adhearsion-0.7.3 vs lib/rami.rb in adhearsion-0.7.4

- old
+ new

@@ -364,16 +364,16 @@ end def connect - puts "Connecting to Asterisk Manager Interface at #{@host}:#{@port}" + log "Connecting to Asterisk Manager Interface at #{@host}:#{@port}" @sock = nil begin @sock = TCPSocket.new(@host,@port) rescue => e - $stderr.puts <<-MSG + warn <<-MSG * Adhearsion First Time Setup * * Whoops! Adhearsion tried to connect to the Asterisk Manager Interface * at #{@host}:#{@port} but the connection was refused! If you don't wish @@ -407,11 +407,11 @@ end end return true end rescue Timeout::Error => e - puts "LOGIN TIMEOUT" + error "LOGIN TIMEOUT" return false end def mainloop @@ -465,11 +465,11 @@ event[linecount] = line end end end rescue IOError => e - puts "Socket disconnected #{e}" + error "Socket disconnected #{e}" end end end def parseline(line) @@ -502,13 +502,13 @@ # Starts the server and connects to asterisk. def run if connect - puts "#{Time.now} MSG: LOGGED IN" + log "#{Time.now} MSG: LOGGED IN" else - puts "#{Time.now} MSG: LOGIN FAILED" + error "#{Time.now} MSG: LOGIN FAILED" exit end mainloop end @@ -809,14 +809,14 @@ sleep 0.10 end end return result rescue Exception => e - puts "#{e}: TIMEOUT #{t} #{sent_id}" - puts e.backtrace + warn "#{e}: TIMEOUT #{t} #{sent_id}" + debug e.backtrace return result end end rescue Exception => e - puts e + error e end