Class: CurriculumGenerator::Util::Logging

Inherits:
Object
  • Object
show all
Defined in:
lib/curriculum-generator/util/logging.rb

Class Method Summary collapse

Class Method Details

.indentObject



25
26
27
# File 'lib/curriculum-generator/util/logging.rb', line 25

def self.indent
  "  "
end

.log(name, opts = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/curriculum-generator/util/logging.rb', line 5

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

.prefixObject



21
22
23
# File 'lib/curriculum-generator/util/logging.rb', line 21

def self.prefix
  ">>"
end