From f4d8e2a79d8e029d978b4c1909b764ee97d9ae12 Mon Sep 17 00:00:00 2001 From: Anton Vanyukov Date: Fri, 10 Nov 2023 06:55:08 +1000 Subject: [PATCH] Improve logging --- app/traits/trait-helpers.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/traits/trait-helpers.php b/app/traits/trait-helpers.php index 1155d52..22a7e5d 100644 --- a/app/traits/trait-helpers.php +++ b/app/traits/trait-helpers.php @@ -46,6 +46,7 @@ public function get_slug(): string { */ public function is_set_up(): bool { if ( get_option( 'cf-images-auth-error', false ) ) { + do_action( 'cf_images_log', 'Option cf-images-auth-error is present in the database: %s', get_option( 'cf-images-auth-error', false ) ); return false; } @@ -53,7 +54,12 @@ public function is_set_up(): bool { $config_written = get_option( 'cf-images-config-written', false ); $defines_found = defined( 'CF_IMAGES_ACCOUNT_ID' ) && defined( 'CF_IMAGES_KEY_TOKEN' ); - return ( $config_written && $saved ) || $defines_found; + $is_set_up = ( $config_written && $saved ) || $defines_found; + if ( ! $is_set_up ) { + do_action( 'cf_images_log', 'Plugin is not setup. Defines status: %s, config written: %s', $defines_found, $config_written ); + } + + return $is_set_up; } /**