diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-09-03 23:48:11 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-09-03 23:48:11 +0200 |
commit | 58efd0a22ecd656eb57649ee421212b78a59ec8a (patch) | |
tree | 8b7bedf3469860575b33ca5107dcfc1d209b7503 | |
parent | 76b92fd85f056b1dede81f8313080d3bd8e38aef (diff) | |
download | woocommerce-taler-58efd0a22ecd656eb57649ee421212b78a59ec8a.tar.gz woocommerce-taler-58efd0a22ecd656eb57649ee421212b78a59ec8a.tar.bz2 woocommerce-taler-58efd0a22ecd656eb57649ee421212b78a59ec8a.zip |
sort out logging
-rw-r--r-- | plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php b/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php index 784ea91..9662477 100644 --- a/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php +++ b/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php @@ -43,7 +43,6 @@ define("MERCHANT_PROTOCOL_AGE", 0); /* TODO (with FIXME in code): -- test WC_Logger based logging, document log/ logging - figure out where OIDC logic should go TODO (without FIXME in code): @@ -131,7 +130,7 @@ function gnutaler_init_gateway_class() 'products', 'refunds', ); - // FIXME: I think this broke! + // Setup logging. $this->debug = 'yes' === $this->get_option( 'debug', 'no' ); self::$log_enabled = $this->debug; @@ -235,7 +234,6 @@ function gnutaler_init_gateway_class() function( $redirect_url, $user ) { // Take over the redirection complete. Send users somewhere special based on their capabilities. global $woocommerce; - // FIXME: check if WC is actually running first? $checkout_url = $woocommerce->cart->wc_get_checkout_url (); wp_redirect( $checkout_url); // or admin_url( $checkout_url) )?; exit(); @@ -869,9 +867,7 @@ function gnutaler_init_gateway_class() */ function debug ($msg) : void { - $dlog = $this->get_option( 'GNU_Taler_Debug_Log' ); - if ($dlog) - $this->log ("debug", $msg); + $this->log ("debug", $msg); } /** @@ -925,25 +921,7 @@ function gnutaler_init_gateway_class() self::$logger = wc_get_logger(); } self::$logger->log( $level, $user_id . '-' . $order_id . ': ' . $msg, array ('source' => 'gnutaler' ) ); - $this->add_log_entry( $level, $user_id . '-' . $order_id . ': ' . $msg ); } - /** - * Creates or opens the log files and writes a log entry. - * - * @param $type - What kind of log it is. - * @param $message - What the message of the log entry is. - * @return void - Returns void. - */ - // FIXME: document '/log' directory must exist for this to work! - function add_log_entry( $type, $message ): void - { - $timestamp = date( 'r' ); - $file = fopen( __DIR__ . '/log/GNUTaler_' . $type . '.log', 'ab' ); - if ( $file !== null ) { - fwrite( $file, $timestamp . ' - ' . $message . PHP_EOL ); - fclose( $file ); - } - } } } |