Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EE::notice() support #1582

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion php/EE/Loggers/Regular.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,23 @@ public function warning( $message ) {
}

/**
* Write an message to STDERR, prefixed with "Error: ".
* Write a message to STDERR, prefixed with "Error: ".
*
* @param string $message Message to write.
*/
public function error( $message ) {
$this->_line( $message, 'Error', '%R', STDERR );
}

/**
* Write a message, prefixed with "Notice: ".
*
* @param string $message Message to write.
*/
public function notice( $message ) {
$this->_line( $message, 'Notice', '%y' );
}

/**
* Similar to error( $message ), but outputs $message in a red box
*
Expand Down
11 changes: 11 additions & 0 deletions php/EE/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,17 @@ public function start() {
$this->arguments[] = 'help';
}

// Print a deprecation warning if 'create' or 'delete' is being used (ee auth).
if ( 'auth' === $this->arguments[0] && ( 'create' === $this->arguments[1] || 'delete' === $this->arguments[1] ) ) {
$deprecation_warn = sprintf(
'`%1$s` is deprecated and will be replaced with `%2$s`. See: `ee auth %2$s`',
$this->arguments[1],
( 'create' === $this->arguments[1] ? 'add' : 'remove' )
);

EE::notice( $deprecation_warn );
}

// Protect 'cli info' from most of the runtime,
// except when the command will be run over SSH
if ( ! empty( $this->arguments[0] ) && 'cli' === $this->arguments[0] && ! empty( $this->arguments[1] ) && 'info' === $this->arguments[1] ) {
Expand Down
11 changes: 11 additions & 0 deletions php/class-ee.php
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,17 @@ public static function warning( $message ) {
self::$file_logger->warning( $message );
}

/**
* Display notice message prefixed with "Notice: ".
*
* @param string $message Message to write.
*
* @return null
*/
public static function notice( $message ) {
self::$logger->notice( self::error_to_string( $message ) );
}

/**
* Display error message prefixed with "Error: " and exit script.
*
Expand Down