Sha256: 0896bf5b3ca6034d7dd7da7df58c1f545ab5f0989e253d2f028559c5dfbfb359

Contents?: true

Size: 784 Bytes

Versions: 29

Compression:

Stored size: 784 Bytes

Contents

# frozen_string_literal: true

module I18n::Tasks::Logging
  module_function

  MUTEX = Mutex.new
  PROGRAM_NAME = File.basename($PROGRAM_NAME)

  def warn_deprecated(message)
    log_stderr Rainbow("#{program_name}: [DEPRECATED] #{message}").yellow.bright
  end

  def log_verbose(message = nil)
    log_stderr Rainbow(message || yield).blue.bright if ::I18n::Tasks.verbose?
  end

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

  def log_error(message)
    log_stderr Rainbow("#{program_name}: #{message}").red.bright
  end

  def log_stderr(*args)
    # We don't want output from different threads to get intermixed.
    MUTEX.synchronize do
      $stderr.puts(*args)
    end
  end

  def program_name
    PROGRAM_NAME
  end
end

Version data entries

29 entries across 29 versions & 3 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/i18n-tasks-1.0.14/lib/i18n/tasks/logging.rb
i18n-tasks-1.0.13 lib/i18n/tasks/logging.rb
i18n-tasks-1.0.12 lib/i18n/tasks/logging.rb
i18n-tasks-1.0.11 lib/i18n/tasks/logging.rb
i18n-tasks-1.0.10 lib/i18n/tasks/logging.rb
i18n-tasks-1.0.9 lib/i18n/tasks/logging.rb
i18n-tasks-1.0.8 lib/i18n/tasks/logging.rb
i18n-tasks-1.0.7 lib/i18n/tasks/logging.rb
i18n-tasks-1.0.6 lib/i18n/tasks/logging.rb
i18n-tasks-1.0.5 lib/i18n/tasks/logging.rb
i18n-tasks-1.0.4 lib/i18n/tasks/logging.rb
i18n-tasks-1.0.3 lib/i18n/tasks/logging.rb
i18n-tasks-1.0.2 lib/i18n/tasks/logging.rb
i18n-tasks-1.0.1 lib/i18n/tasks/logging.rb
i18n-tasks-1.0.0 lib/i18n/tasks/logging.rb
i18n-youdao-tasks-0.9.37 lib/i18n/tasks/logging.rb
i18n-tasks-0.9.37 lib/i18n/tasks/logging.rb
i18n-tasks-0.9.36 lib/i18n/tasks/logging.rb
i18n-tasks-0.9.35 lib/i18n/tasks/logging.rb
i18n-tasks-0.9.34 lib/i18n/tasks/logging.rb