403Webshell
Server IP : 38.190.208.107  /  Your IP : 216.73.217.46
Web Server : nginx/1.28.1
System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64
User : root ( 0)
PHP Version : 8.2.28
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/wp.5/wp-content/plugins/woocommerce-payments/src/Internal/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/wp.5/wp-content/plugins/woocommerce-payments/src/Internal/Logger.php
<?php
/**
 * Class Logger
 *
 * @package WooCommerce\Payments
 */

namespace WCPay\Internal;

use Exception;
use WC_Log_Levels;
use WC_Logger_Interface;
use WC_Payment_Gateway_WCPay;
use WCPay\Core\Mode;
use WCPay\Logger_Context;

/**
 * A wrapper class for interacting with WC_Logger.
 */
class Logger {

	const LOG_FILENAME = 'woopayments';

	/**
	 * The holding property for our WC_Logger_Interface instance.
	 *
	 * @var WC_Logger_Interface $logger
	 */
	private $wc_logger;

	/**
	 * Mode
	 *
	 * @var Mode
	 */
	private $mode;

	/**
	 * Logger constructor.
	 *
	 * @param WC_Logger_Interface $wc_logger    WC_Logger_Interface.
	 * @param Mode                $mode         Mode.
	 */
	public function __construct( WC_Logger_Interface $wc_logger, Mode $mode ) {
		$this->wc_logger = $wc_logger;
		$this->mode      = $mode;
	}

	/**
	 * Add a log entry.
	 *
	 * @param string               $message Log message.
	 * @param string               $level One of the following:
	 *                   'emergency': System is unusable.
	 *                   'alert': Action must be taken immediately.
	 *                   'critical': Critical conditions.
	 *                   'error': Error conditions.
	 *                   'warning': Warning conditions.
	 *                   'notice': Normal but significant condition.
	 *                   'info': Informational messages.
	 *                   'debug': Debug-level messages.
	 * @param array<string, mixed> $context Context data.
	 */
	public function log( $message, $level = 'info', $context = [] ): void {
		if ( ! $this->can_log() ) {
			return;
		}
		$context = array_merge( Logger_Context::get_context(), $context, [ 'source' => self::LOG_FILENAME ] );
		$this->wc_logger->log( $level, $message, $context );
	}

	/**
	 * Checks if the setting logging toggle is enabled.
	 *
	 * @return bool Depending on the enable_logging setting.
	 */
	public function can_log() {
		try {
			if ( $this->mode->is_dev() ) {
				return true;
			}
		} catch ( Exception $e ) {
			return false;
		}

		// Getting the gateway settings directly from the database so the gateway doesn't need to be initialized.
		$settings_option_name = 'woocommerce_' . WC_Payment_Gateway_WCPay::GATEWAY_ID . '_settings';
		$wcpay_settings       = get_option( $settings_option_name );

		return 'yes' === ( $wcpay_settings['enable_logging'] ?? false );
	}

	/**
	 * Creates a log entry of type emergency
	 *
	 * @param string               $message To send to the log file.
	 * @param array<string, mixed> $context Context data.
	 */
	public function emergency( $message, $context = [] ): void {
		$this->log( $message, WC_Log_Levels::EMERGENCY, $context );
	}

	/**
	 * Creates a log entry of type alert
	 *
	 * @param string               $message To send to the log file.
	 * @param array<string, mixed> $context Context data.
	 */
	public function alert( $message, $context = [] ): void {
		$this->log( $message, WC_Log_Levels::ALERT, $context );
	}

	/**
	 * Creates a log entry of type critical
	 *
	 * @param string               $message To send to the log file.
	 * @param array<string, mixed> $context Context data.
	 */
	public function critical( $message, $context = [] ): void {
		$this->log( $message, WC_Log_Levels::CRITICAL, $context );
	}

	/**
	 * Creates a log entry of type error
	 *
	 * @param string               $message To send to the log file.
	 * @param array<string, mixed> $context Context data.
	 */
	public function error( $message, $context = [] ): void {
		$this->log( $message, WC_Log_Levels::ERROR, $context );
	}

	/**
	 * Creates a log entry of type warning
	 *
	 * @param string               $message To send to the log file.
	 * @param array<string, mixed> $context Context data.
	 */
	public function warning( $message, $context = [] ): void {
		$this->log( $message, WC_Log_Levels::WARNING, $context );
	}

	/**
	 * Creates a log entry of type notice
	 *
	 * @param string               $message To send to the log file.
	 * @param array<string, mixed> $context Context data.
	 */
	public function notice( $message, $context = [] ): void {
		$this->log( $message, WC_Log_Levels::NOTICE, $context );
	}

	/**
	 * Creates a log entry of type info
	 *
	 * @param string               $message To send to the log file.
	 * @param array<string, mixed> $context Context data.
	 */
	public function info( $message, $context = [] ): void {
		$this->log( $message, WC_Log_Levels::INFO, $context );
	}

	/**
	 * Creates a log entry of type debug
	 *
	 * @param string               $message To send to the log file.
	 * @param array<string, mixed> $context Context data.
	 */
	public function debug( $message, $context = [] ): void {
		$this->log( $message, WC_Log_Levels::DEBUG, $context );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit