commit f7cd4c4d1327baa00ef88d6296ec606bc8e2330b Author: Luka Vandervelden Date: Fri Nov 8 23:56:07 2019 +0100 Initial commit. diff --git a/src/weird-crystal-base.cr b/src/weird-crystal-base.cr new file mode 100644 index 0000000..2b22792 --- /dev/null +++ b/src/weird-crystal-base.cr @@ -0,0 +1,34 @@ +require "colorize" + +class Weird::Base + # 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 +