Class: IO
- Inherits:
-
Object
- Object
- IO
- Defined in:
- lib/react_native_util/core_ext/io.rb
Overview
Logging extensions to the IO class
Instance Method Summary collapse
-
#log(message, obfuscate: true) ⇒ Object
Logs a message with obfuscation and a timestamp.
-
#log_command(command) ⇒ Object
Logs a command to be executed by a call such as Kernel#system.
Instance Method Details
#log(message, obfuscate: true) ⇒ Object
Logs a message with obfuscation and a timestamp.
13 14 15 16 |
# File 'lib/react_native_util/core_ext/io.rb', line 13 def log(, obfuscate: true) = .to_s.obfuscate if obfuscate puts "#{DateTime.now} #{message}" end |
#log_command(command) ⇒ Object
Logs a command to be executed by a call such as Kernel#system. If the command parameter is an Array, it will be joined using Array#shelljoin from shellwords. Otherwise it will be interpolated in a String.
25 26 27 28 29 30 |
# File 'lib/react_native_util/core_ext/io.rb', line 25 def log_command(command) string_to_log = (command.kind_of?(Array) ? command.shelljoin : command) log "$ #{string_to_log}".cyan.bold flush nil end |