getConfigHashmap(); // Checks if custom factory defined, and is it an implementation of @PayPalLogFactory $factory = array_key_exists('log.AdapterFactory', $config) && in_array('PayPal\Log\PayPalLogFactory', class_implements($config['log.AdapterFactory'])) ? $config['log.AdapterFactory'] : '\PayPal\Log\PayPalDefaultLogFactory'; /** @var PayPalLogFactory $factoryInstance */ $factoryInstance = new $factory(); $this->logger = $factoryInstance->getLogger($loggerName); $this->loggerName = $loggerName; } /** * Log Error * * @param string $message */ public function error($message) { $this->logger->error($message); } /** * Log Warning * * @param string $message */ public function warning($message) { $this->logger->warning($message); } /** * Log Info * * @param string $message */ public function info($message) { $this->logger->info($message); } /** * Log Fine * * @param string $message */ public function fine($message) { $this->info($message); } /** * Log Debug * * @param string $message */ public function debug($message) { $config = PayPalConfigManager::getInstance()->getConfigHashmap(); // Disable debug in live mode. if (array_key_exists('mode', $config) && $config['mode'] != 'live') { $this->logger->debug($message); } } }