lib/wagn.rb in wagn-1.14.1 vs lib/wagn.rb in wagn-1.14.2
- old
+ new
@@ -1,12 +1,11 @@
# should be able to move these to more appropriate places
-
WAGN_GEM_ROOT = File.expand_path('../..', __FILE__)
module Wagn
- class << self
+ class << self
def root
Rails.root
end
def application
@@ -23,11 +22,24 @@
def gem_root
WAGN_GEM_ROOT
end
+ def with_logging cardname, method, message, details, &block
+ if Wagn.config.performance_logger and
+ Wagn.config.performance_logger[:methods] and
+ Wagn.config.performance_logger[:methods].include? method
+ Wagn::Log.start_block :cardname=>cardname, :method=>method, :message=>message, :details=>details
+ result = block.call
+ Wagn::Log.finish_block
+ result
+ else
+ block.call
+ end
+ end
+
def future_stamp
## used in test data
@@future_stamp ||= Time.local 2020,1,1,0,0,0
end
end
-end
\ No newline at end of file
+end