From f7cd4c4d1327baa00ef88d6296ec606bc8e2330b Mon Sep 17 00:00:00 2001 From: Luka Vandervelden Date: Fri, 8 Nov 2019 23:56:07 +0100 Subject: [PATCH] Initial commit. --- src/weird-crystal-base.cr | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/weird-crystal-base.cr 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 +