@@ -480,19 +480,20 @@ public static function remove_deferred_addition( $name ) {
480480 }
481481
482482 /**
483- * Display informational message without prefix, and ignore `--quiet` .
483+ * Display informational message without prefix.
484484 *
485- * Message is written to STDOUT. `EE::log()` is typically recommended;
486- * `EE::line ()` is included for historical compat .
485+ * Should only be used for displaying sensitive info which should be skipped from log file.
486+ * `EE::log ()` is typically recommended for everything else .
487487 *
488- * @access public
488+ * @access public
489489 * @category Output
490490 *
491491 * @param string $message Message to display to the end user.
492+ *
492493 * @return null
493494 */
494495 public static function line ( $ message = '' ) {
495- echo $ message . "\n" ;
496+ self :: $ logger -> info ( $ message ) ;
496497 }
497498
498499 /**
@@ -818,19 +819,21 @@ public static function error_to_string( $errors ) {
818819 * @access public
819820 * @category Execution
820821 *
821- * @param string $command External process to launch.
822+ * @param string $command External process to launch.
822823 * @param boolean $exit_on_error Whether to exit if the command returns an elevated return code.
823824 * @param boolean $return_detailed Whether to return an exit status (default) or detailed execution results.
824- * @param array $env Environment variables to set when running the command.
825- * @param string $cwd Directory to execute the command in.
825+ * @param array $obfuscate Parts of the command that need to be obfuscated.
826+ * @param array $env Environment variables to set when running the command.
827+ * @param string $cwd Directory to execute the command in.
826828 *
827829 * @return int|ProcessRun The command exit status, or a ProcessRun object for full details.
828830 */
829- public static function launch ( $ command , $ exit_on_error = false , $ return_detailed = true , $ env = null , $ cwd = null ) {
831+ public static function launch ( $ command , $ exit_on_error = false , $ return_detailed = true , $ obfuscate = [], $ env = null , $ cwd = null ) {
830832 Utils \check_proc_available ( 'launch ' );
831833
834+ $ command_to_log = empty ( $ obfuscate ) ? $ command : str_replace ( $ obfuscate , '****** ' , $ command );
832835 self ::debug ( '----------------------- ' );
833- self ::debug ( "COMMAND: $ command " );
836+ self ::debug ( "COMMAND: $ command_to_log " );
834837
835838 $ proc = Process::create ( $ command , $ cwd , $ env );
836839 $ results = $ proc ->run ();
@@ -858,18 +861,20 @@ public static function launch( $command, $exit_on_error = false, $return_detaile
858861 * @access public
859862 * @category Execution
860863 *
861- * @param string $command External process to launch.
862- * @param bool $echo_stdout Print stdout to terminal. Default false.
863- * @param bool $echo_stderr Print stderr to terminal. Default false.
864+ * @param string $command External process to launch.
865+ * @param bool $echo_stdout Print stdout to terminal. Default false.
866+ * @param bool $echo_stderr Print stderr to terminal. Default false.
867+ * @param array $obfuscate Parts of the command that need to be obfuscated.
864868 * @param boolean $exit_on_error Exit if the command returns an elevated return code with stderr.
865869 *
866870 * @return bool True if executed successfully. False if failed.
867871 */
868- public static function exec ( $ command , $ echo_stdout = false , $ echo_stderr = false , $ exit_on_error = false ) {
872+ public static function exec ( $ command , $ echo_stdout = false , $ echo_stderr = false , $ obfuscate = [], $ exit_on_error = false ) {
869873 Utils \check_proc_available ( 'exec ' );
870874
875+ $ command_to_log = empty ( $ obfuscate ) ? $ command : str_replace ( $ obfuscate , '****** ' , $ command );
871876 self ::debug ( '----------------------- ' );
872- self ::debug ( "COMMAND: $ command " );
877+ self ::debug ( "COMMAND: $ command_to_log " );
873878
874879 $ proc = Process::create ( $ command , null , null );
875880 $ results = $ proc ->run ();
0 commit comments