lib/hydra/trace.rb in sskirby-hydra-0.21.0 vs lib/hydra/trace.rb in sskirby-hydra-0.23.3
- old
+ new
@@ -1,10 +1,8 @@
module Hydra #:nodoc:
# Trace output when in verbose mode.
module Trace
- REMOTE_IDENTIFIER = 'REMOTE'
-
module ClassMethods
# Make a class traceable. Takes one parameter,
# which is the prefix for the trace to identify this class
def traceable(prefix = self.class.to_s)
include Hydra::Trace::InstanceMethods
@@ -16,13 +14,10 @@
module InstanceMethods
# Trace some output with the class's prefix and a newline.
# Checks to ensure we're running verbosely.
def trace(str)
- return unless @verbose
- remote_info = @remote ? "#{REMOTE_IDENTIFIER} #{@remote} " : ''
- str = str.gsub /\n/, "\n#{remote_info}"
- $stdout.write "#{Time.now.to_f} #{remote_info}#{self.class._traceable_prefix}| #{str}\n"
+ $stdout.write "#{Time.now.to_f} #{self.class._traceable_prefix}| #{str}\n" if @verbose
end
end
end
end
Object.extend(Hydra::Trace::ClassMethods)