src/HookListener/CronDebugListener.php
private function cron_action_profile() {

		if ( ! defined( 'DOING_CRON' ) || ! DOING_CRON ) {
			return;
		}

		$hook = current_filter();
		if ( ! isset( $this->done[ $hook ] ) ) {
			$this->done[ $hook ][ 'start' ] = microtime( TRUE );

			return;
		}

		if ( ! isset( $this->done[ $hook ][ 'duration' ] ) ) {

			$duration = number_format( microtime( TRUE ) - $this->done[ $hook ][ 'start' ], 2 );

			$this->done[ $hook ][ 'duration' ] = $duration . ' s';

			// Log the cron action performed.
			do_action(
				\Inpsyde\Wonolog\LOG,
				new Info( "Cron action \"{$hook}\" performed.", Channels::DEBUG, $this->done[ $hook ] )
			);
		}
	}
private function cron_action_profile() {

		if ( ! defined( 'DOING_CRON' ) || ! DOING_CRON ) {
			return;
		}

		$hook = current_filter();
		if ( ! isset( $this->done[ $hook ] ) ) {
			$this->done[ $hook ][ 'start' ] = microtime( TRUE );

			return;
		}

		if ( ! isset( $this->done[ $hook ][ 'duration' ] ) ) {

			$duration = number_format( microtime( TRUE ) - $this->done[ $hook ][ 'start' ], 2 );

			$this->done[ $hook ][ 'duration' ] = $duration . ' s';

			// Log the cron action performed.
			do_action(
				\Inpsyde\Wonolog\LOG,
				new Info( "Cron action \"{$hook}\" performed.", Channels::DEBUG, $this->done[ $hook ] )
			);
		}
	}
private function cron_action_profile ( ) { if ( ! defined ( 'DOING_CRON' ) || ! DOING_CRON ) { return ; } $ hook = current_filter ( ) ; if ( ! isset ( $ this -> done [ $ hook ] ) ) { $ this -> done [ $ hook ] [ 'start' ] = microtime ( TRUE ) ; return ; } if ( ! isset ( $ this -> done [ $ hook ] [ 'duration' ] ) ) { $ duration = number_format ( microtime ( TRUE ) - $ this -> done [ $ hook ] [ 'start' ] , 2 ) ; $ this -> done [ $ hook ] [ 'duration' ] = $ duration . ' s' ; // Log the cron action performed. do_action ( \ Inpsyde \ Wonolog \ LOG , new Info ( "Cron action \"{$hook}\" performed." , Channels :: DEBUG , $ this -> done [ $ hook ] ) ) ; } }
Run before and after that any cron action ran, logging it and its performance.
Run before and after that any cron action ran logging it and its performance .