Sha256: f8b2da9b8a3eafa3b7c54959a2fa07ed1e434b65922cab7c3270d3076090a5c9

Contents?: true

Size: 726 Bytes

Versions: 4

Compression:

Stored size: 726 Bytes

Contents

# frozen_string_literal: true
module I18n::Tasks::Logging
  extend self

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

  def log_verbose(message = nil, &block)
    if ::I18n::Tasks.verbose?
      log_stderr Term::ANSIColor.bright_blue(message || block.call)
    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

4 entries across 4 versions & 1 rubygems

Version Path
i18n-tasks-0.9.6 lib/i18n/tasks/logging.rb
i18n-tasks-0.9.5 lib/i18n/tasks/logging.rb
i18n-tasks-0.9.4 lib/i18n/tasks/logging.rb
i18n-tasks-0.9.3 lib/i18n/tasks/logging.rb