Sha256: 4be16bf854e8d7eed8827f71350d7c104b6067b51a13fe3970fc4f46fce56915

Contents?: true

Size: 724 Bytes

Versions: 24

Compression:

Stored size: 724 Bytes

Contents

# frozen_string_literal: true

module PlutoniumGenerators
  module Concerns
    module Logger
      def debug(msg)
        say format_log(msg, :debug), :magenta
      end

      def info(msg)
        say format_log(msg, :info), :blue
      end

      def success(msg)
        say format_log(msg, :success), :green
      end

      def error(msg)
        say format_log(msg, :error), :red
        exit(1)
      end

      def exception(msg, err)
        error "#{msg}\n\n#{err}\n#{err.backtrace.join("\n")}"
      end

      private

      def format_log(msg, _log_level)
        # indentation = ' ' * (log_level.length + 2)
        # "#{log_level}: #{msg}" # .lines.join(indentation)
        msg
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
plutonium-0.11.2 lib/generators/pu/lib/plutonium_generators/concerns/logger.rb
plutonium-0.11.1 lib/generators/pu/lib/plutonium_generators/concerns/logger.rb
plutonium-0.11.0 lib/generators/pu/lib/plutonium_generators/concerns/logger.rb
plutonium-0.8.0 lib/generators/pu/lib/plutonium_generators/concerns/logger.rb