Permalink
Browse files

Added timeservice to log service loading time.

  • Loading branch information...
1 parent 7567f79 commit 847505331bbafdb8609c16a8f1928a621e8e1563 Willa committed Nov 28, 2012
Showing with 22 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +2 −1 lib/crowdring.rb
  3. +19 −0 lib/crowdring/time_service.rb
View
@@ -3,3 +3,4 @@ logfile
.DS_Store
dump.rdb
UTF-8
+log_file.log
View
@@ -14,7 +14,8 @@
require 'lazy_high_charts'
require 'statsd'
require 'json'
-
+require 'logger'
+require 'crowdring/time_service'
require 'crowdring/telephony_services/telephony_service'
require 'crowdring/telephony_services/twilio_service'
require 'crowdring/telephony_services/kookoo_service'
@@ -0,0 +1,19 @@
+require 'logger'
+module Crowdring
+ class TimeService
+ $LOG = Logger.new('log_file.log')
+
+ def initialize(name, service)
+ @name = name
+ @service = service
+ end
+
+ def method_missing(method, *args, &block)
+ start_time = Time.now
+ result = @service.send(method, *args, &block)
+ end_time = Time.now
+ $LOG.debug("#{@name}: #{method}, #{end_time - start_time}s")
+ result
+ end
+ end
+end

0 comments on commit 8475053

Please sign in to comment.