Module: I18n::Tasks::Logging
- Included in:
- BaseTask, CLI, Command::Commander, Data::FileSystemBase, Reports::Base, Scanners::Files::FileFinder, Translators::BaseTranslator
- Defined in:
- lib/i18n/tasks/logging.rb
Constant Summary collapse
- MUTEX =
Mutex.new
- PROGRAM_NAME =
File.basename($PROGRAM_NAME)
Class Method Summary collapse
- .log_error(message) ⇒ Object
- .log_stderr(*args) ⇒ Object
- .log_verbose(message = nil) ⇒ Object
- .log_warn(message) ⇒ Object
- .program_name ⇒ Object
- .warn_deprecated(message) ⇒ Object
Class Method Details
.log_error(message) ⇒ Object
21 22 23 |
# File 'lib/i18n/tasks/logging.rb', line 21 def log_error() log_stderr Rainbow("#{program_name}: #{}").red.bright end |
.log_stderr(*args) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/i18n/tasks/logging.rb', line 25 def log_stderr(*args) # We don't want output from different threads to get intermixed. MUTEX.synchronize do $stderr.puts(*args) end end |
.log_verbose(message = nil) ⇒ Object
13 14 15 |
# File 'lib/i18n/tasks/logging.rb', line 13 def log_verbose( = nil) log_stderr Rainbow( || yield).blue.bright if ::I18n::Tasks.verbose? end |
.log_warn(message) ⇒ Object
17 18 19 |
# File 'lib/i18n/tasks/logging.rb', line 17 def log_warn() log_stderr Rainbow("#{program_name}: [WARN] #{}").yellow end |
.program_name ⇒ Object
32 33 34 |
# File 'lib/i18n/tasks/logging.rb', line 32 def program_name PROGRAM_NAME end |
.warn_deprecated(message) ⇒ Object
9 10 11 |
# File 'lib/i18n/tasks/logging.rb', line 9 def warn_deprecated() log_stderr Rainbow("#{program_name}: [DEPRECATED] #{}").yellow.bright end |