* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ namespace PrestaShop\Module\PrestashopCheckout\Logger; use PrestaShop\Module\PrestashopCheckout\Configuration\PrestaShopConfiguration; /** * Class responsible for returning logger settings */ class LoggerConfiguration { const MAX_FILES = 15; const LEVEL_DEBUG = 100; /** * Interesting events * * Examples: User logs in, SQL logs. */ const LEVEL_INFO = 200; /** * Uncommon events */ const LEVEL_NOTICE = 250; /** * Exceptional occurrences that are not errors * * Examples: Use of deprecated APIs, poor use of an API, * undesirable things that are not necessarily wrong. */ const LEVEL_WARNING = 300; /** * Runtime errors */ const LEVEL_ERROR = 400; /** * Critical conditions * * Example: Application component unavailable, unexpected exception. */ const LEVEL_CRITICAL = 500; /** * Action must be taken immediately * * Example: Entire website down, database unavailable, etc. * This should trigger the SMS alerts and wake you up. */ const LEVEL_ALERT = 550; /** * Urgent alert. */ const LEVEL_EMERGENCY = 600; /** * @var PrestaShopConfiguration */ private $configuration; /** * @param PrestaShopConfiguration $configuration */ public function __construct(PrestaShopConfiguration $configuration) { $this->configuration = $configuration; } /** * @return int */ public function getMaxFiles() { return (int) $this->configuration->get( LoggerFactory::PS_CHECKOUT_LOGGER_MAX_FILES, [ 'default' => static::MAX_FILES, 'global' => true, ] ); } /** * @return int */ public function getLevel() { return (int) $this->configuration->get( LoggerFactory::PS_CHECKOUT_LOGGER_LEVEL, [ 'default' => static::LEVEL_ERROR, 'global' => true, ] ); } public function isHttpEnabled() { return $this->configuration->get(LoggerFactory::PS_CHECKOUT_LOGGER_HTTP, [ 'default' => false, ]); } }