package/src/io.cr

35 lines
622 B
Crystal

require "colorize"
class Weird::Context
# FIXME: Use log files.
# FIXME: def log(), that puts stuff as-is in the logs.
def debug(text)
STDERR.puts ":: #{text}".colorize(:cyan)
STDERR.flush
end
def info(text)
STDOUT
.<<(":: ".colorize(:blue))
.<<(text.colorize(:white))
.<<("\n")
STDOUT.flush
end
def title(text)
STDOUT
.<<("|> ".colorize(:blue).bright)
.<<(text.colorize(:white).bright)
.<<("\n")
STDOUT.flush
end
def warning(text)
STDERR.puts ":: #{text}".colorize(:yellow)
STDERR.flush
end
def error(text)
STDERR.puts "!! #{text}".colorize(:red)
STDERR.flush
end
end