Module: McBlocky::Logging

Included in:
Cli, Listener, Server
Defined in:
lib/mcblocky/logging.rb

Constant Summary collapse

RESET =
"\e[0m"
BOLD =
"\e[1m"
RED =
"\e[31m"
GREEN =
"\e[32m"
YELLOW =
"\e[33m"
BLUE =
"\e[34m"
MAGENTA =
"\e[35m"
CYAN =
"\e[36m"
WHITE =
"\e[37m"
@@mutex =
Mutex.new

Instance Method Summary collapse

Instance Method Details

#log_command(message) ⇒ Object



27
28
29
30
31
# File 'lib/mcblocky/logging.rb', line 27

def log_command(message)
  @@mutex.synchronize do
    puts "#{CYAN}#{BOLD}/#{message.chomp}#{RESET}"
  end
end

#log_error(message) ⇒ Object



39
40
41
42
43
# File 'lib/mcblocky/logging.rb', line 39

def log_error(message)
  @@mutex.synchronize do
    puts "#{RED}#{BOLD}---> #{message.chomp}#{RESET}"
  end
end

#log_message(message) ⇒ Object



21
22
23
24
25
# File 'lib/mcblocky/logging.rb', line 21

def log_message(message)
  @@mutex.synchronize do
    puts "#{MAGENTA}#{message.chomp}#{RESET}"
  end
end

#log_server(message) ⇒ Object



15
16
17
18
19
# File 'lib/mcblocky/logging.rb', line 15

def log_server(message)
  @@mutex.synchronize do
    puts "#{YELLOW}#{message.chomp}#{RESET}"
  end
end

#log_status(message) ⇒ Object



33
34
35
36
37
# File 'lib/mcblocky/logging.rb', line 33

def log_status(message)
  @@mutex.synchronize do
    puts "#{GREEN}#{BOLD}---> #{message.chomp}#{RESET}"
  end
end