Skip to content
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
21 changes: 2 additions & 19 deletions facebook-commerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -1343,23 +1343,6 @@ public function update_product_group( WC_Facebook_Product $woo_product ) {
$variants = $woo_product->prepare_variants_for_group();

if ( ! $variants ) {
Logger::log(
sprintf(
/* translators: %1$s is referring to facebook product group id. */
__(
'Nothing to update for product group for %1$s',
'facebook-for-woocommerce'
),
$fb_product_group_id
),
[],
array(
'should_send_log_to_meta' => false,
'should_save_log_in_woocommerce' => true,
'woocommerce_log_level' => \WC_Log_Levels::DEBUG,
)
);

return;
}

Expand Down Expand Up @@ -2249,7 +2232,7 @@ private function sync_facebook_products_using_background_processor() {
array(
'should_send_log_to_meta' => false,
'should_save_log_in_woocommerce' => true,
'woocommerce_log_level' => \WC_Log_Levels::DEBUG,
'woocommerce_log_level' => \WC_Log_Levels::WARNING,
)
);
throw new PluginException( __( 'The plugin is not configured or the Catalog ID is missing.', 'facebook-for-woocommerce' ) );
Expand Down Expand Up @@ -2304,7 +2287,7 @@ private function sync_facebook_products_using_background_processor() {
array(
'should_send_log_to_meta' => false,
'should_save_log_in_woocommerce' => true,
'woocommerce_log_level' => \WC_Log_Levels::DEBUG,
'woocommerce_log_level' => \WC_Log_Levels::WARNING,
)
);
WC_Facebookcommerce_Utils::fblog(
Expand Down
24 changes: 19 additions & 5 deletions includes/Framework/ErrorLogHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,27 @@ public function process_error_log( $raw_context ) {
$context = self::set_core_log_context( $raw_context );
try {
$response = facebook_for_woocommerce()->get_api()->log_to_meta( $context );
if ( $response->success ) {
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( 'Error log: ' . wp_json_encode( $context ), \WC_Log_Levels::ERROR );
} else {
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( 'Bad response from log_to_meta request', \WC_Log_Levels::ERROR );
if ( ! $response->success ) {
Logger::log(
'Bad response from log_to_meta request',
[],
array(
'should_send_log_to_meta' => false,
'should_save_log_in_woocommerce' => true,
'woocommerce_log_level' => \WC_Log_Levels::ERROR,
)
);
}
} catch ( \Exception $e ) {
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( 'Error persisting error logs: ' . $e->getMessage(), \WC_Log_Levels::ERROR );
Logger::log(
'Error persisting error logs: ' . $e->getMessage(),
[],
array(
'should_send_log_to_meta' => false,
'should_save_log_in_woocommerce' => true,
'woocommerce_log_level' => \WC_Log_Levels::ERROR,
)
);
}
}

Expand Down
3 changes: 0 additions & 3 deletions includes/fbproduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -2107,8 +2107,6 @@ public function prepare_variants_for_item( &$product_data ) {
break;
}//end switch
} else {

\WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $product->get_id() . ': No options for ' . $original_variant_name );
continue;
}//end if
}//end foreach
Expand Down Expand Up @@ -2162,7 +2160,6 @@ public function prepare_variants_for_group( $feed_data = false ) {
$option_values = $variation_attributes[ $key ];
} else {
// skip variations without valid attribute options
\WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $product->get_id() . ': No options for ' . $name );
continue;
}

Expand Down