Class: OrmDev::LogUtil

Inherits:
Object
  • Object
show all
Defined in:
lib/ormdev/source/util/log_util.rb

Constant Summary collapse

ORMDEV_CLT_INFO_LOG_FLAG =
'[OrmDev]'

Class Method Summary collapse

Class Method Details

.debug(msg = '') ⇒ Object



9
10
11
# File 'lib/ormdev/source/util/log_util.rb', line 9

def self.debug(msg = '')
  puts msg
end

.info(msg = '') ⇒ Object



13
14
15
# File 'lib/ormdev/source/util/log_util.rb', line 13

def self.info(msg = '')
  puts "#{ORMDEV_CLT_INFO_LOG_FLAG}#{msg}"
end


17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ormdev/source/util/log_util.rb', line 17

def self.link(link, message)
  puts message unless message.nil?
  unless link.nil?
    puts " - "  + link.blue.underlined

    if ENV["TERM_PROGRAM"] == "iTerm.app"
      puts " ( hold cmd and click links to open in a browser. )".magenta
    else
      puts " ( hold cmd and double click links to open in a browser. )".magenta
    end
  end
end


30
31
32
# File 'lib/ormdev/source/util/log_util.rb', line 30

def self.print_command(content)
  puts content.green.bold
end


44
45
46
47
48
49
50
51
52
# File 'lib/ormdev/source/util/log_util.rb', line 44

def self.print_error(content)
  puts '****************************************'.red
  puts "*    #{Time.new}         *".red
  puts '*                                      *'.red
  puts '*               Error ~                *'.red.bold
  puts '*                                      *'.red
  puts content
  puts '****************************************'.red
end


34
35
36
37
38
39
40
41
42
# File 'lib/ormdev/source/util/log_util.rb', line 34

def self.print_success(content)
  puts '****************************************'.green
  puts "*    #{Time.new}         *".green
  puts '*                                      *'.green
  puts '*                 OK ~                 *'.green.bold
  puts '*                                      *'.green
  puts content
  puts '****************************************'.green
end