Skip to content

Commit ebf084c

Browse files
refactor to use the pre-existing debug switch
1 parent 0925c7b commit ebf084c

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

features/cron-event.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ Feature: Manage WP Cron events
159159
Debug: Arguments:
160160
"""
161161

162-
Scenario: Confirm that cron event run with verbose flag lists both before and after
163-
When I run `wp cron event run --due-now --verbose`
164-
Then STDOUT should contain:
162+
Scenario: Confirm that cron event run in debug mode shows the start of events
163+
When I run `wp cron event run --due-now --debug=cron`
164+
Then STDERR should contain:
165165
"""
166166
Beginning execution of cron event
167167
"""

src/Cron_Event_Command.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,6 @@ public function schedule( $args, $assoc_args ) {
225225
* [--all]
226226
* : Run all hooks.
227227
*
228-
* [--verbose]
229-
* : List event both before and after execution.
230-
*
231228
* ## EXAMPLES
232229
*
233230
* # Run all cron events due right now
@@ -247,9 +244,7 @@ public function run( $args, $assoc_args ) {
247244
$executed = 0;
248245
$verbose = Utils\get_flag_value( $assoc_args, 'verbose' );
249246
foreach ( $events as $event ) {
250-
if ( $verbose ) {
251-
WP_CLI::log( sprintf( "Beginning execution of cron event '%s'.", $event->hook ) );
252-
}
247+
WP_CLI::debug( sprintf( "Beginning execution of cron event '%s'.", $event->hook ), 'cron' );
253248
$start = microtime( true );
254249
$result = self::run_event( $event );
255250
$total = round( microtime( true ) - $start, 3 );

0 commit comments

Comments
 (0)