Sha256: c84a5088dc5d783320ea485f8a13d1a75d0574256451a460be4524535d7ad6f6

Contents?: true

Size: 717 Bytes

Versions: 2

Compression:

Stored size: 717 Bytes

Contents

# frozen_string_literal: true
module I18n::Tasks::Logging
  module_function

  def warn_deprecated(message)
    log_stderr Term::ANSIColor.yellow Term::ANSIColor.bold "#{program_name}: [DEPRECATED] #{message}"
  end

  def log_verbose(message = nil)
    if ::I18n::Tasks.verbose?
      log_stderr Term::ANSIColor.bright_blue(message || yield)
    end
  end

  def log_warn(message)
    log_stderr Term::ANSIColor.yellow "#{program_name}: [WARN] #{message}"
  end

  def log_error(message)
    log_stderr Term::ANSIColor.red Term::ANSIColor.bold "#{program_name}: #{message}"
  end

  def log_stderr(*args)
    $stderr.puts(*args)
  end

  def program_name
    @program_name ||= File.basename($PROGRAM_NAME)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
i18n-tasks-0.9.8 lib/i18n/tasks/logging.rb
i18n-tasks-0.9.7 lib/i18n/tasks/logging.rb