From: scribu Date: Fri, 6 Sep 2013 16:27:01 +0000 (+0300) Subject: remove $label parameter from logging methods X-Git-Tag: v0.12.0~41^2~2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8ee1854dd766187e0234490549b1664c3de8937b;p=wvm%2Fwvm.git remove $label parameter from logging methods The label text and color are just a way to signal to the user the type of message. Changing it can lead to confusion. Example: WP_CLI::error( 'Something bad happened!', 'Success' ); --- diff --git a/php/WP_CLI/Loggers/Quiet.php b/php/WP_CLI/Loggers/Quiet.php index 926986c5..6f32fbef 100644 --- a/php/WP_CLI/Loggers/Quiet.php +++ b/php/WP_CLI/Loggers/Quiet.php @@ -8,16 +8,16 @@ class Quiet { // nothing } - function success( $message, $label ) { + function success( $message ) { // nothing } - function warning( $message, $label ) { + function warning( $message ) { // nothing } - function error( $message, $label ) { - fwrite( STDERR, \WP_CLI::colorize( "%R$label:%n $message\n" ) ); + function error( $message ) { + fwrite( STDERR, \WP_CLI::colorize( "%RError:%n $message\n" ) ); } } diff --git a/php/WP_CLI/Loggers/Regular.php b/php/WP_CLI/Loggers/Regular.php index 56c63f56..b992faa1 100644 --- a/php/WP_CLI/Loggers/Regular.php +++ b/php/WP_CLI/Loggers/Regular.php @@ -12,16 +12,16 @@ class Regular { fwrite( STDOUT, $message . "\n" ); } - function success( $message, $label ) { - $this->_line( $message, $label, '%G' ); + function success( $message ) { + $this->_line( $message, 'Success', '%G' ); } - function warning( $message, $label ) { - $this->_line( $message, $label, '%C', STDERR ); + function warning( $message ) { + $this->_line( $message, 'Warning', '%C', STDERR ); } - function error( $message, $label ) { - $this->_line( $message, $label, '%R', STDERR ); + function error( $message ) { + $this->_line( $message, 'Error', '%R', STDERR ); } } diff --git a/php/class-wp-cli.php b/php/class-wp-cli.php index da3a32be..67d06ea4 100644 --- a/php/class-wp-cli.php +++ b/php/class-wp-cli.php @@ -120,31 +120,28 @@ class WP_CLI { * Display a success in the CLI and end with a newline * * @param string $message - * @param string $label */ - static function success( $message, $label = 'Success' ) { - self::$logger->success( $message, $label ); + static function success( $message ) { + self::$logger->success( $message ); } /** * Display a warning in the CLI and end with a newline * * @param string $message - * @param string $label */ - static function warning( $message, $label = 'Warning' ) { - self::$logger->warning( self::error_to_string( $message ), $label ); + static function warning( $message ) { + self::$logger->warning( self::error_to_string( $message ) ); } /** * Display an error in the CLI and end with a newline * * @param string $message - * @param string $label */ - static function error( $message, $label = 'Error' ) { + static function error( $message ) { if ( ! isset( self::get_runner()->assoc_args[ 'completions' ] ) ) { - self::$logger->error( self::error_to_string( $message ), $label ); + self::$logger->error( self::error_to_string( $message ) ); } exit(1);