Sha256: ab3d6501bc002552728e2b9fb9469b0fe493fbfb1f85cfbdfd3234aba91bcb7b

Contents?: true

Size: 876 Bytes

Versions: 1

Compression:

Stored size: 876 Bytes

Contents

module Roger
  module Helpers
    module Logging
      # Write out a log message
      def log(part, msg, verbose = false, &block)
        if !verbose || verbose && self.project.options[:verbose]
          self.project.shell.say "\033[37m#{part.class.to_s}\033[0m" + " : " + msg.to_s, nil, true
        end
        if block_given?
          begin
            self.project.shell.padding = self.project.shell.padding + 1
            yield
          ensure
            self.project.shell.padding = self.project.shell.padding - 1
          end
        end
      end
      
      def debug(part, msg, &block)
        self.log(part, msg, true, &block)
      end
      
      # Write out a warning message
      def warn(part, msg)
        self.project.shell.say "\033[37m#{part.class.to_s}\033[0m" + " : " + "\033[31m#{msg.to_s}\033[0m", nil, true
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roger-0.13.0 lib/roger/helpers/logging.rb