Sha256: ebc15b1a56c7e62ec7dfa053bce16cc2d77a25fb4a0b7864831c33c261d7eda6

Contents?: true

Size: 868 Bytes

Versions: 5

Compression:

Stored size: 868 Bytes

Contents

module CGen::Util::Logging

  def self.log(name, opts={})
    case name
      when :fatal_error
        puts "#{prefix} Fatal error: #{opts[:msg].light_black}. Aborting...".red
      when :loading_curriculum_data
        puts "#{prefix} Loading the curriculum data for ".cyan + opts[:trgt_lang].to_s.light_black
        puts "#{indent} using ".cyan + opts[:master_lang].to_s.light_black + ' as the default'.cyan
      when :executing_command
        puts "#{prefix} Executing          ".cyan + opts[:cmd].to_s.light_black
        puts "#{indent} from the directory ".cyan + opts[:exec_dir].to_s.light_black if opts.has_key? :exec_dir
        puts "#{indent} logging to         ".cyan + opts[:log_file].to_s.light_black if opts.has_key? :log_file
      else
        # nothing to do
    end
  end

  def self.prefix
    '>>'
  end

  def self.indent
    '  '
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
curriculum-generator-1.0.4 lib/cgen/util/logging.rb
curriculum-generator-1.0.3 lib/cgen/util/logging.rb
curriculum-generator-1.0.2 lib/cgen/util/logging.rb
curriculum-generator-1.0.1 lib/cgen/util/logging.rb
curriculum-generator-1.0.0 lib/cgen/util/logging.rb