Initial commit.

master
Karchnu 2020-08-28 01:33:33 +02:00
commit b457854f23
2 changed files with 45 additions and 0 deletions

2
shard.yml Normal file
View File

@ -0,0 +1,2 @@
name: baguette-crystal-base
version: 0.1.0

View File

@ -0,0 +1,43 @@
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