Sha256: 51779c6561e432a79dbb5a4d257480cdb708a23f00d381739c9dc5607ee124f2

Contents?: true

Size: 998 Bytes

Versions: 2

Compression:

Stored size: 998 Bytes

Contents

module CurriculumGenerator
  module Util
    class 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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
curriculum-generator-1.0.7 lib/curriculum-generator/util/logging.rb
curriculum-generator-1.0.6 lib/curriculum-generator/util/logging.rb