44 lines
945 B
Crystal
44 lines
945 B
Crystal
require "colorize"
|
|
|
|
class Baguette::Context
|
|
class_property verbosity = 1
|
|
end
|
|
|
|
class Baguette::Log
|
|
# FIXME: Use log files.
|
|
# FIXME: def log(), that puts stuff as-is in the logs.
|
|
|
|
def self.debug(text)
|
|
return unless Baguette::Context.verbosity > 2
|
|
STDERR.puts ":: #{text}".colorize(:cyan)
|
|
STDERR.flush
|
|
end
|
|
def self.info(text)
|
|
return unless Baguette::Context.verbosity > 1
|
|
STDOUT
|
|
.<<(":: ".colorize(:blue))
|
|
.<<(text.colorize(:white))
|
|
.<<("\n")
|
|
STDOUT.flush
|
|
end
|
|
def self.title(text)
|
|
return unless Baguette::Context.verbosity > 1
|
|
STDOUT
|
|
.<<("|> ".colorize(:blue).bright)
|
|
.<<(text.colorize(:white).bright)
|
|
.<<("\n")
|
|
STDOUT.flush
|
|
end
|
|
def self.warning(text)
|
|
return unless Baguette::Context.verbosity > 0
|
|
STDERR.puts ":: #{text}".colorize(:yellow)
|
|
STDERR.flush
|
|
end
|
|
def self.error(text)
|
|
return unless Baguette::Context.verbosity > 0
|
|
STDERR.puts "!! #{text}".colorize(:red)
|
|
STDERR.flush
|
|
end
|
|
end
|
|
|