-
Notifications
You must be signed in to change notification settings - Fork 42
Added debug mode for logging. #470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master-2.x
Are you sure you want to change the base?
Conversation
lbajsarowicz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure your code follows PSR standard for PHP.
... and even more important: It follows Magento Coding Standards.
2.7. All non-public properties and methods SHOULD be private.
https://developer.adobe.com/commerce/php/coding-standards/technical-guidelines/
| /** | ||
| * @var \Razorpay\Magento\Model\Config | ||
| */ | ||
| protected $config; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /** | |
| * @var \Razorpay\Magento\Model\Config | |
| */ | |
| protected $config; | |
| /** | |
| * @var \Razorpay\Magento\Model\Config | |
| */ | |
| private $config; |
| /** | ||
| * @var \Psr\Log\LoggerInterface | ||
| */ | ||
| protected $logger; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /** | |
| * @var \Psr\Log\LoggerInterface | |
| */ | |
| protected $logger; | |
| /** | |
| * @var \Psr\Log\LoggerInterface | |
| */ | |
| private $logger; |
| public function __construct( | ||
| \Razorpay\Magento\Model\Config $config, | ||
| \Psr\Log\LoggerInterface $logger | ||
| ) | ||
| { | ||
| $this->config = $config; | ||
| $this->logger = $logger; | ||
|
|
||
| $this->isDebugModeEnabled = $this->config->isDebugModeEnabled(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Import classes
- Lint your code
| $this->logger->info($message); | ||
| } | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are working in the *nix environment, make sure to leave empty line at the EOF (PSR)
| { | ||
| foreach ($orderLink as $orderData) | ||
| { | ||
| $this->debug->log("Cronjob: Magento Order Id = " . $orderData['order_id'] . " picked for updation"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please acknowledge PSR-3 standard (https://www.php-fig.org/psr/psr-3/) for LoggerInterface and use the 2nd argument -- $context. Example:
| $this->debug->log("Cronjob: Magento Order Id = " . $orderData['order_id'] . " picked for updation"); | |
| $this->logger->debug("Cronjob: Magento Order picked for update", ['order_id' => $orderData['order_id']]); |
PS: What is "updation"?
| /** | ||
| * @var \Razorpay\Magento\Model\Util\DebugMode | ||
| */ | ||
| protected $debug; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.7. All non-public properties and methods SHOULD be private.
https://developer.adobe.com/commerce/php/coding-standards/technical-guidelines/
| protected $debug; | |
| private $debug; |
Note :- Please follow the below points while attaching test cases document link below:
- If label
Testedis added then test cases document URL is mandatory.- Link added should be a valid URL and accessible throughout the org.
- If the branch name contains hotfix / revert by default the BVT workflow check will pass.