We will be off on April 7th (Monday) for public holiday in our country

  • Attila Kiss's avatar
    [PW-2499] Fix codesniffer warnings and errors and prepare Release 6.1.2 (#737) · 5dfbe4d2
    Attila Kiss authored
    * Update phpcs to validate PSR2 rules
    
    * Fix PSR2 phpcs errors with phpcbf
    
    * Fix phpcs errors with phpcbf
    
    * Fix PSR2 phpcs errors
    
    * Reapply fix for boleto lastname key
    
    * Fix Api folder
    
    * Fix phpcs warning
    
    * Fix phpcs warning
    
    * Remove unused var
    
    * Version bump 6.1.2
    
    * Fix MagentoStandard phpcs warnings
    
    * Part of fixing the code sniffer errors
    
    * Part of fixing the code sniffer errors
    
    * Fix Magento Marketplace codesniffing warnings
    
    * Fix some code sniffer errors with phpcbf
    
    * Autoformat PSR12
    
    * Fix the path string with ::class
    
    * Fix empty spaces warnings
    
    * Fix Magento marketplace codesniffing warnings
    
    * Fix Magento marketplace codesniffing warnings
    
    * Set arguments defaults values at the end of the argument list
    
    * Code sniffer fixes
    
    * Fix Magento marketplace codesniffing warnings
    
    * remove empty return statement
    
    * Fix Static method cannot be intercepted error
    
    * Fix eror: Possible useless method overriding detected
    
    * Remove private const since it is only supported since php 7.1
    
    * Fix wrong class paths
    
    * Fix sonarcloud bugs
    
    table th element should have scope attribute when possible
    
    * Fix codesmells
    
    * Fix unit test
    
    * Remove ISSUE_TEMPLATE.md
    
    * fix wrong function call for formatStreet()
    
    * Add removed _prepareLayout() function back
    
    * Update Model/Cron.php
    Co-authored-by: default avatarÁngel Campos <angel.campos@adyen.com>
    
    * Update Model/Cron.php
    Co-authored-by: default avatarÁngel Campos <angel.campos@adyen.com>
    
    * Fix request's paymentMethod field
    Co-authored-by: default avataralexandros <alexandros.moraitis@adyen.com>
    Co-authored-by: default avatarÁngel Campos <angel.campos@adyen.com>
    Unverified
    5dfbe4d2
AdyenLogger.php 3.59 KB
<?php
/**
 *                       ######
 *                       ######
 * ############    ####( ######  #####. ######  ############   ############
 * #############  #####( ######  #####. ######  #############  #############
 *        ######  #####( ######  #####. ######  #####  ######  #####  ######
 * ###### ######  #####( ######  #####. ######  #####  #####   #####  ######
 * ###### ######  #####( ######  #####. ######  #####          #####  ######
 * #############  #############  #############  #############  #####  ######
 *  ############   ############  #############   ############  #####  ######
 *                                      ######
 *                               #############
 *                               ############
 *
 * Adyen Payment module (https://www.adyen.com/)
 *
 * Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
 * See LICENSE.txt for license details.
 *
 * Author: Adyen <magento@adyen.com>
 */

namespace Adyen\Payment\Logger;

use Monolog\Logger;

class AdyenLogger extends Logger
{
    /**
     * Detailed debug information
     */
    const ADYEN_DEBUG = 101;
    const ADYEN_NOTIFICATION = 201;
    const ADYEN_RESULT = 202;
    const ADYEN_NOTIFICATION_CRONJOB = 203;

    /**
     * Logging levels from syslog protocol defined in RFC 5424
     * Overrule the default to add Adyen specific loggers to log into seperate files
     *
     * @var array $levels Logging levels
     */
    protected static $levels = [
        100 => 'DEBUG',
        101 => 'ADYEN_DEBUG',
        200 => 'INFO',
        201 => 'ADYEN_NOTIFICATION',
        202 => 'ADYEN_RESULT',
        203 => 'ADYEN_NOTIFICATION_CRONJOB',
        250 => 'NOTICE',
        300 => 'WARNING',
        400 => 'ERROR',
        500 => 'CRITICAL',
        550 => 'ALERT',
        600 => 'EMERGENCY',
    ];

    /**
     * Adds a log record at the INFO level.
     *
     * This method allows for compatibility with common interfaces.
     *
     * @param string $message The log message
     * @param array $context The log context
     * @return Boolean Whether the record has been processed
     */
    public function addAdyenNotification($message, array $context = [])
    {
        return $this->addRecord(static::ADYEN_NOTIFICATION, $message, $context);
    }

    public function addAdyenDebug($message, array $context = [])
    {
        return $this->addRecord(static::ADYEN_DEBUG, $message, $context);
    }

    public function addAdyenResult($message, array $context = [])
    {
        return $this->addRecord(static::ADYEN_RESULT, $message, $context);
    }

    public function addAdyenNotificationCronjob($message, array $context = [])
    {
        return $this->addRecord(static::ADYEN_NOTIFICATION_CRONJOB, $message, $context);
    }

    /**
     * Adds a log record.
     *
     * @param integer $level The logging level
     * @param string $message The log message
     * @param array $context The log context
     * @return Boolean Whether the record has been processed
     */
    public function addRecord($level, $message, array $context = [])
    {
        $context['is_exception'] = $message instanceof \Exception;
        return parent::addRecord($level, $message, $context);
    }

    /**
     * Adds a log record at the INFO level.
     *
     * This method allows for compatibility with common interfaces.
     *
     * @param string $message The log message
     * @param array $context The log context
     * @return Boolean Whether the record has been processed
     */
    public function addNotificationLog($message, array $context = [])
    {
        return $this->addRecord(static::INFO, $message, $context);
    }
}