From 2ced54ccccca00da32e9f1d36ee3e3d4b140ffae Mon Sep 17 00:00:00 2001 From: Karchnu Date: Wed, 4 Nov 2020 19:23:58 +0100 Subject: [PATCH] Color corrections. --- src/baguette-crystal-base.cr | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/baguette-crystal-base.cr b/src/baguette-crystal-base.cr index c12da62..39d0a24 100644 --- a/src/baguette-crystal-base.cr +++ b/src/baguette-crystal-base.cr @@ -101,12 +101,15 @@ class Baguette::Log # 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) + return unless Baguette::Context.verbosity > 3 + STDERR + .<<(":: ".colorize(:cyan)) + .<<(text.colorize(:cyan)) + .<<("\n") STDERR.flush end def self.info(text) - return unless Baguette::Context.verbosity > 1 + return unless Baguette::Context.verbosity > 2 STDOUT .<<(":: ".colorize(:blue)) .<<(text.colorize(:white)) @@ -114,7 +117,7 @@ class Baguette::Log STDOUT.flush end def self.title(text) - return unless Baguette::Context.verbosity > 1 + return unless Baguette::Context.verbosity > 2 STDOUT .<<("|> ".colorize(:blue).bright) .<<(text.colorize(:white).bright) @@ -122,13 +125,19 @@ class Baguette::Log STDOUT.flush end def self.warning(text) - return unless Baguette::Context.verbosity > 0 - STDERR.puts ":: #{text}".colorize(:yellow) + return unless Baguette::Context.verbosity > 1 + STDERR + .<<(":: ".colorize(:yellow).bright) + .<<(text.colorize(:yellow)) + .<<("\n") STDERR.flush end def self.error(text) return unless Baguette::Context.verbosity > 0 - STDERR.puts "!! #{text}".colorize(:red) + STDERR + .<<("!! ".colorize(:red).bright) + .<<(text.colorize(:red)) + .<<("\n") STDERR.flush end end