lib/minke.rb in minke-1.12.9 vs lib/minke.rb in minke-1.13.0

- old
+ new

@@ -15,14 +15,14 @@ require 'securerandom' require 'sshkey' require 'mkmf' require 'minke/version' +require 'minke/command' require 'minke/helpers/copy' require 'minke/helpers/error' -require 'minke/helpers/logger' require 'minke/helpers/rake' require 'minke/helpers/shell' require 'minke/docker/docker_compose' require 'minke/docker/docker_runner' @@ -52,5 +52,37 @@ require 'minke/generators/register' require 'minke/generators/shell_script' require 'minke/encryption/encryption' require 'minke/encryption/key_locator' + +module Minke + class Logging + @@debug = false + @@ret = "\n" + + def self.create_logger verbose = false + Logger.new(STDOUT).tap do |l| + l.datetime_format = '' + l.formatter = proc do |severity, datetime, progname, msg| + case severity + when 'ERROR' + s = "#{@@ret if @@debug}#{'ERROR'.colorize(:red)}: #{msg.chomp('')}\n" + @@debug = false + s + when 'INFO' + s = "#{@@ret if @@debug}#{'INFO'.colorize(:green)}: #{msg.chomp('')}\n" + @@debug = false + s + when 'DEBUG' + if verbose == true + "#{'DEBUG'.colorize(:yellow)}: #{msg.chomp('')}\n" + else + @@debug = true + "#{'.'.colorize(:yellow)}" + end + end + end + end + end + end +end \ No newline at end of file