diff --git a/inc/Engine/Admin/RocketInsights/APIHandler/APIClient.php b/inc/Engine/Admin/RocketInsights/APIHandler/APIClient.php index 8d3d897daa..0c4aa53c6d 100644 --- a/inc/Engine/Admin/RocketInsights/APIHandler/APIClient.php +++ b/inc/Engine/Admin/RocketInsights/APIHandler/APIClient.php @@ -52,14 +52,6 @@ public function add_to_queue( string $url, array $options = [], array $args = [] $args ); - $this->logger::debug( - 'Rocket Insights: Initiating test', - [ - 'url' => $url, - 'options' => $options, - ] - ); - $sent = $this->handle_post( $args ); if ( ! $sent ) { @@ -78,13 +70,6 @@ public function add_to_queue( string $url, array $options = [], array $args = [] $response_data = json_decode( $this->response_body, true ); - $this->logger::info( - 'Rocket Insights: Test initiated successfully', - [ - 'job_id' => $response_data['uuid'], - ] - ); - $response_data['code'] = $this->response_code; return $response_data; @@ -107,11 +92,6 @@ public function get_queue_job_status( string $test_id, $queue_name, $is_home = f 'timeout' => 15, ]; - $this->logger::debug( - 'Rocket Insights: Checking test status', - [ 'test_id' => $test_id ] - ); - $sent = $this->handle_get( $args ); if ( ! $sent ) { @@ -146,14 +126,6 @@ public function get_queue_job_status( string $test_id, $queue_name, $is_home = f return $error_data; } - $this->logger::debug( - 'Rocket Insights: Status check completed', - [ - 'test_id' => $test_id, - 'status' => $response_data['status'] ?? 'unknown', - ] - ); - switch ( $response_data['status'] ?? 'pending' ) { case 'pending': $code = 425; diff --git a/inc/Engine/Admin/RocketInsights/Jobs/Manager.php b/inc/Engine/Admin/RocketInsights/Jobs/Manager.php index df6d6d4bf4..a5cca86e5d 100644 --- a/inc/Engine/Admin/RocketInsights/Jobs/Manager.php +++ b/inc/Engine/Admin/RocketInsights/Jobs/Manager.php @@ -70,12 +70,9 @@ public function __construct( * @return array */ public function get_pending_jobs( int $num_rows ): array { - $this->logger::debug( "Rocket Insights: Start getting number of {$num_rows} pending jobs." ); - $pending_jobs = $this->query->get_pending_jobs( $num_rows ); if ( ! $pending_jobs ) { - $this->logger::debug( 'Rocket Insights: No pending jobs are there.' ); return []; } @@ -157,25 +154,11 @@ public function process( array $job_details, $row_details, string $optimization_ } if ( ! empty( $job_details['status'] ) && 'pending' === $job_details['status'] ) { - $this->logger::info( - 'Rocket Insights: Revert to pending because of API status is pending', - [ - 'job_id' => $row_details->job_id, - ] - ); - $this->query->revert_to_pending( $row_details->id ); + return; } - $this->logger::info( - 'Rocket Insights: Test completed successfully', - [ - 'job_id' => $row_details->job_id, - 'score' => $job_details['performance_score'] ?? null, - ] - ); - $this->query->make_status_completed( $row_details->id, 'completed', $this->parse_test_results( $job_details ) ); $row_details = $this->query->get_row_by_id( $row_details->id ); diff --git a/inc/Engine/Common/JobManager/JobProcessor.php b/inc/Engine/Common/JobManager/JobProcessor.php index 41222009d6..f72732cb38 100644 --- a/inc/Engine/Common/JobManager/JobProcessor.php +++ b/inc/Engine/Common/JobManager/JobProcessor.php @@ -96,16 +96,11 @@ public function process_pending_jobs() { '3.16', 'rocket_rucss_process_pending_jobs_start' ); - $this->logger::debug( 'RUCSS: Start processing pending jobs inside cron.' ); if ( ! $this->is_allowed() ) { - $this->logger::debug( 'Stop processing cron iteration for pending jobs.' ); - return; } - $this->logger::debug( 'Start processing pending jobs inside cron.' ); - // Get some items from the DB with status=pending & job_id isn't empty. /** @@ -161,10 +156,8 @@ public function process_pending_jobs() { * @return void */ public function check_job_status( string $url, bool $is_mobile, string $optimization_type ) { - $row_details = $this->get_single_job( $url, $is_mobile, $optimization_type ); if ( ! is_object( $row_details ) ) { - $this->logger::debug( 'Url - ' . $url . ' not found for is_mobile - ' . (int) $is_mobile ); // Nothing in DB, bailout. return; } @@ -227,8 +220,6 @@ public function check_job_status( string $url, bool $is_mobile, string $optimiza * @return void */ public function process_on_submit_jobs() { - $this->logger::debug( 'Start processing on submit jobs for adding jobs to queue.' ); - /** * Fires at the start of the process on submit jobs. * @@ -242,8 +233,6 @@ public function process_on_submit_jobs() { ); if ( ! $this->is_allowed() ) { - $this->logger::debug( 'Stop processing cron iteration for to-submit jobs.' ); - return; } @@ -309,7 +298,6 @@ public function process_on_submit_jobs() { ); } - $this->logger::debug( 'End processing on submit jobs for adding jobs to queue.' ); /** * Fires at the end of the process pending jobs. * diff --git a/inc/Engine/Common/Queue/RUCSSQueueRunner.php b/inc/Engine/Common/Queue/RUCSSQueueRunner.php index 2af712f130..0620799a06 100644 --- a/inc/Engine/Common/Queue/RUCSSQueueRunner.php +++ b/inc/Engine/Common/Queue/RUCSSQueueRunner.php @@ -223,7 +223,7 @@ protected function do_batch( $size = 100, $context = '' ) { $this->reset_group(); return $processed_actions; } catch ( \Exception $exception ) { - Logger::debug( $exception->getMessage() ); + Logger::error( $exception->getMessage() ); $this->reset_group(); return 0; } diff --git a/inc/Engine/Media/ImageDimensions/ImageDimensions.php b/inc/Engine/Media/ImageDimensions/ImageDimensions.php index 4f4934ad27..eb7023b1d7 100644 --- a/inc/Engine/Media/ImageDimensions/ImageDimensions.php +++ b/inc/Engine/Media/ImageDimensions/ImageDimensions.php @@ -82,10 +82,7 @@ public function sanitize_option_value( array $input, Settings $settings ): array * @return string Buffer Page HTML contents after inserting dimensions into images. */ public function specify_image_dimensions( $html ) { - Logger::debug( 'Start Specify Image Dimensions.' ); - if ( ! $this->can_specify_dimensions_images() ) { - Logger::debug( 'Specify Image Dimensions failed because option is not enabled from admin or by filter (rocket_specify_image_dimensions).' ); return $html; } @@ -124,8 +121,6 @@ public function specify_image_dimensions( $html ) { */ $images = apply_filters( 'rocket_specify_dimension_images', $images_match[0] ); - Logger::debug( 'Specify Image Dimensions found ( ' . count( $images ) . ' ).', $images ); - foreach ( $images as $image ) { $image_url = $this->can_specify_dimensions_one_image( $image ); diff --git a/inc/Engine/Media/Lazyload/CSS/Subscriber.php b/inc/Engine/Media/Lazyload/CSS/Subscriber.php index 1e736d9b5a..53ac6df4f6 100644 --- a/inc/Engine/Media/Lazyload/CSS/Subscriber.php +++ b/inc/Engine/Media/Lazyload/CSS/Subscriber.php @@ -159,20 +159,10 @@ public static function get_subscribed_events() { * @return string */ public function maybe_replace_css_images( string $html ): string { - if ( ! $this->context->is_allowed() ) { return $html; } - $this->logger::debug( - 'Starting lazyload', - $this->generate_log_context( - [ - 'data' => $html, - ] - ) - ); - /** * Generate lazyload CSS for the page. * @@ -187,26 +177,11 @@ public function maybe_replace_css_images( string $html ): string { ); if ( ! key_exists( 'html', $output ) ) { - $this->logger::debug( - 'Lazyload bailed out', - $this->generate_log_context( - [ - 'data' => $html, - ] - ) - ); + $this->logger::debug( 'Lazyload CSS bailed out' ); + return $html; } - $this->logger::debug( - 'Ending lazyload', - $this->generate_log_context( - [ - 'data' => $html, - ] - ) - ); - $html = $this->add_meta_comment( 'lazyload_css_bg_img', $output['html'] ); return $html; @@ -218,10 +193,6 @@ public function maybe_replace_css_images( string $html ): string { * @return void */ public function clear_generated_css() { - $this->logger::debug( - 'Clear lazy CSS', - $this->generate_log_context() - ); $this->cache->clear(); } @@ -302,7 +273,7 @@ public function create_lazy_css_files( array $data ): array { if ( $this->is_excluded( $url ) ) { $this->logger::debug( - "Excluded lazy css files $url", + "Excluded lazy css file $url", $this->generate_log_context() ); continue; @@ -310,15 +281,10 @@ public function create_lazy_css_files( array $data ): array { $url_key = $this->format_url( $url ); if ( ! $this->cache->has( $url_key ) ) { - $this->logger::debug( - "Generate lazy css files $url", - $this->generate_log_context() - ); - $file_mapping = $this->generate_css_file( $url ); if ( empty( $file_mapping ) ) { $this->logger::debug( - "Create lazy css files $url bailed out", + "Create lazy css file $url bailed out", $this->generate_log_context() ); continue; @@ -327,10 +293,6 @@ public function create_lazy_css_files( array $data ): array { $mapping = array_merge( $mapping, $file_mapping ); } else { - $this->logger::debug( - "Load lazy css files $url", - $this->generate_log_context() - ); $mapping = array_merge( $mapping, $this->load_existing_mapping( $url ) ); } @@ -364,7 +326,6 @@ public function create_lazy_css_files( array $data ): array { * @return array */ public function add_lazy_tag( array $data ): array { - if ( ! key_exists( 'html', $data ) || ! key_exists( 'lazyloaded_images', $data ) ) { $this->logger::debug( 'Add lazy tag bailed out', @@ -387,15 +348,7 @@ public function add_lazy_tag( array $data ): array { */ $loaded = apply_filters( 'rocket_css_image_lazyload_images_load', [], $lazyload_images ); - $tags = $this->tag_generator->generate( $lazyload_images, $loaded ); - $this->logger::debug( - 'Add lazy tag generated', - $this->generate_log_context( - [ - 'data' => $tags, - ] - ) - ); + $tags = $this->tag_generator->generate( $lazyload_images, $loaded ); $data['html'] = str_replace( '', "$tags", $data['html'] ); return $data; @@ -655,15 +608,6 @@ protected function generate_asset_url( string $url ): string { $cached_url = $this->cache->generate_url( $this->format_url( $url ) ); - $this->logger::debug( - "Generated url lazy css files $url", - $this->generate_log_context( - [ - 'data' => $cached_url, - ] - ) - ); - return add_query_arg( $queries, $cached_url ); } diff --git a/inc/Engine/Optimization/Buffer/Optimization.php b/inc/Engine/Optimization/Buffer/Optimization.php index 356de45529..d155737a1b 100755 --- a/inc/Engine/Optimization/Buffer/Optimization.php +++ b/inc/Engine/Optimization/Buffer/Optimization.php @@ -28,19 +28,6 @@ class Optimization extends Abstract_Buffer { */ protected $tests; - /** - * Constructor. - * - * @since 3.3 - * - * @param Tests $tests Tests instance. - */ - public function __construct( Tests $tests ) { - parent::__construct( $tests ); - - $this->log( 'OPTIMIZATION PROCESS STARTED.', [], 'info' ); - } - /** ----------------------------------------------------------------------------------------- */ /** CACHE =================================================================================== */ /** ----------------------------------------------------------------------------------------- */ diff --git a/inc/Engine/Optimization/GoogleFonts/Combine.php b/inc/Engine/Optimization/GoogleFonts/Combine.php index cd897894cb..228cb97952 100644 --- a/inc/Engine/Optimization/GoogleFonts/Combine.php +++ b/inc/Engine/Optimization/GoogleFonts/Combine.php @@ -50,7 +50,6 @@ class Combine extends AbstractGFOptimization { */ public function optimize( $html ): string { $this->font_urls = []; - Logger::info( 'GOOGLE FONTS COMBINE PROCESS STARTED.', [ 'GF combine process' ] ); $html_nocomments = $this->hide_comments( $html ); $fonts = $this->find( '])+)?(?:\s+href\s*=\s*([\'"])(?(?:https?:)?\/\/fonts\.googleapis\.com\/css[^\d](?:(?!\1).)+)\1)(?:\s+[^>]*)?>', $html_nocomments ); @@ -76,14 +75,6 @@ function ( $font ) use ( $exclusions ) { $num_fonts = count( $filtered_fonts ); - Logger::debug( - "Found {$num_fonts} Google Fonts after exclusions.", - [ - 'GF combine process', - 'tags' => $filtered_fonts, - ] - ); - $this->parse( $filtered_fonts ); if ( empty( $this->fonts ) ) { @@ -98,14 +89,6 @@ function ( $font ) use ( $exclusions ) { $html = str_replace( $font[0], '', $html ); } - Logger::info( - 'Google Fonts successfully combined.', - [ - 'GF combine process', - 'url' => $this->fonts . $this->subsets, - ] - ); - return $html; } diff --git a/inc/Engine/Optimization/GoogleFonts/CombineV2.php b/inc/Engine/Optimization/GoogleFonts/CombineV2.php index c92ccffa3c..ee73a55716 100644 --- a/inc/Engine/Optimization/GoogleFonts/CombineV2.php +++ b/inc/Engine/Optimization/GoogleFonts/CombineV2.php @@ -32,7 +32,6 @@ class CombineV2 extends AbstractGFOptimization { */ public function optimize( $html ): string { $this->font_urls = []; - Logger::info( 'GOOGLE FONTS COMBINE-V2 PROCESS STARTED.', [ 'GF combine process' ] ); $processed_tags = []; $html_nocomments = $this->hide_comments( $html ); @@ -59,14 +58,6 @@ function ( $tag ) use ( $exclusions ) { $num_tags = count( $filtered_tags ); - Logger::debug( - "Found {$num_tags} v2 Google Fonts after exclusions.", - [ - 'GF combine process', - 'tags' => $filtered_tags, - ] - ); - $families = []; foreach ( $filtered_tags as $tag ) { $parsed_families = $this->parse( $tag ); @@ -89,14 +80,6 @@ function ( $tag ) use ( $exclusions ) { $html = str_replace( $font[0], '', $html ); } - Logger::info( - 'V2 Google Fonts successfully combined.', - [ - 'GF combine process', - 'url' => $combined_url, - ] - ); - return $html; } diff --git a/inc/Engine/Optimization/Minify/CSS/Minify.php b/inc/Engine/Optimization/Minify/CSS/Minify.php index 6e94222aa0..0a2aee17ad 100644 --- a/inc/Engine/Optimization/Minify/CSS/Minify.php +++ b/inc/Engine/Optimization/Minify/CSS/Minify.php @@ -26,8 +26,6 @@ class Minify extends AbstractCSSOptimization implements ProcessorInterface { * @return string */ public function optimize( $html ) { - Logger::info( 'CSS MINIFICATION PROCESS STARTED.', [ 'css minification process' ] ); - $styles = $this->get_styles( $html ); if ( empty( $styles ) ) { @@ -99,14 +97,6 @@ protected function get_styles( $html ) { return []; } - Logger::debug( - 'Found ' . count( $styles ) . ' `` tags.', - [ - 'css minification process', - 'tags' => $styles, - ] - ); - return $styles; } @@ -141,14 +131,6 @@ private function replace_url( $url ) { $minified_file = rawurldecode( $this->minify_base_path . $filename ); if ( rocket_direct_filesystem()->exists( $minified_file ) ) { - Logger::debug( - 'Minified CSS file already exists.', - [ - 'css minification process', - 'path' => $minified_file, - ] - ); - return $this->get_full_minified_url( $minified_file, $this->get_minify_url( $filename, $url ) ); } @@ -216,14 +198,6 @@ protected function replace_style( $style, $minify_url, $html ) { $replace_style = str_replace( ' $minify_url, - ] - ); - return $html; } @@ -251,13 +225,6 @@ protected function save_minify_file( $minified_file, $minified_content ) { return false; } - Logger::debug( - 'Minified CSS file successfully created.', - [ - 'css minification process', - 'path' => $minified_file, - ] - ); return true; } diff --git a/inc/Engine/Optimization/Minify/JS/Combine.php b/inc/Engine/Optimization/Minify/JS/Combine.php index 2658ee4c32..a6f2fdc4cd 100644 --- a/inc/Engine/Optimization/Minify/JS/Combine.php +++ b/inc/Engine/Optimization/Minify/JS/Combine.php @@ -87,7 +87,6 @@ public function __construct( * @return string */ public function optimize( $html ) { - Logger::info( 'JS COMBINE PROCESS STARTED.', [ 'js combine process' ] ); $html_nocomments = $this->hide_comments( $html ); $scripts = $this->find( '', $html_nocomments ); @@ -97,14 +96,6 @@ public function optimize( $html ) { return $html; } - Logger::debug( - 'Found ' . count( $scripts ) . ' `