Skip to content
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

Updated monolog/monolog to 2.3.1 #33497

Conversation

andrewbess
Copy link
Contributor

@andrewbess andrewbess commented Jul 15, 2021

Description (*)

This PR (pull request) updates the monolog/monolog library to the latest version 2.3.1.
Also, it fixes the codebase to take compatibility after updating the library.

Related Pull Requests

https://github.com/magento/partners-magento2ee/pull/561

Fixed Issues (if relevant)

  1. Fixes Update monolog/monolog to the latest version #32868

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Jul 15, 2021

Hi @andrewbess. Thank you for your contribution
Here are some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me platform-health instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@m2-community-project m2-community-project bot added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Jul 15, 2021
@magento-engcom-team magento-engcom-team added Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner labels Jul 15, 2021
@andrewbess andrewbess requested a review from sivaschenko July 15, 2021 20:15
@andrewbess
Copy link
Contributor Author

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@andrewbess
Copy link
Contributor Author

@magento run Static Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@andrewbess
Copy link
Contributor Author

@magento run Unit Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@andrewbess andrewbess force-pushed the improvement/CE-32868-update-monolog-to-latest-version branch from ab6ef75 to 249d587 Compare July 16, 2021 07:01
@andrewbess
Copy link
Contributor Author

@magento run Static Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

if ($configValue === null) {
$isEnabled = $this->state->getMode() !== State::MODE_PRODUCTION;
} else {
$isEnabled = (bool)$configValue;
$isEnabled = (bool) $configValue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$isEnabled = (bool) $configValue;
$isEnabled = (bool)$configValue;

Copy link
Contributor Author

@andrewbess andrewbess Jul 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ihor-sviziev.
Thank you for your suggestion, but space symbol is exist in examples from PSR-12. Also codesniffer proposes to have space symbol here.
Thank you again )))

Comment on lines +69 to +73
public function addRecord(
int $level,
string $message,
array $context = []
): bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not spend space vertically, when it's not needed. Before it looked much better.

Suggested change
public function addRecord(
int $level,
string $message,
array $context = []
): bool {
public function addRecord(int $level, string $message, array $context = []): bool
{

Comment on lines 34 to 38
public function __construct(
$name,
array $handlers = [],
array $processors = []
) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function __construct(
$name,
array $handlers = [],
array $processors = []
) {
public function __construct($name, array $handlers = [], array $processors = [] )
{

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ihor-sviziev
Thank you for your suggestion.
I strive for perfection and try to write my code according to PSR-12 (p.2.3).
This line contains more than 80 symbols.

throw new InvalidArgumentException(
'Filename expected to be a string'
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new InvalidArgumentException(
'Filename expected to be a string'
);
throw new InvalidArgumentException('Filename expected to be a string');

use Magento\Framework\Filesystem\DriverInterface;
use Magento\Framework\Logger\Handler\Exception as ExceptionHandler;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to name it HandlerException, as ExceptionHandler means that it will handle some exception(s).

Suggested change
use Magento\Framework\Logger\Handler\Exception as ExceptionHandler;
use Magento\Framework\Logger\Handler\Exception as HandlerException;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ihor-sviziev
Thank you for your suggestion.
The property of this class has already been named $exceptionHandler. Why do we need to change the style of the alias?
Also, the style of alias naming like xxxxxHandler has already existed in Magento.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ihor-sviziev I think ExceptionHandler is the better name, as this class is a handler, not an exception

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sivaschenko @andrewbess it definitely make sense. From the class name I just thought it’s opposite

Comment on lines 56 to 58
$message = $message instanceof Exception
? $message->getMessage()
: $message;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$message = $message instanceof Exception
? $message->getMessage()
: $message;
$message = $message instanceof Exception ? $message->getMessage() : $message;

Comment on lines +45 to +47
$this->exceptionHandlerMock = $this->getMockBuilder(
ExceptionHandler::class
)->disableOriginalConstructor()->getMock();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we replace it with the following?

Suggested change
$this->exceptionHandlerMock = $this->getMockBuilder(
ExceptionHandler::class
)->disableOriginalConstructor()->getMock();
$this->exceptionHandlerMock = $this->createMock(ExceptionHandler::class);

Comment on lines 43 to 44
$this->filesystemMock = $this->getMockBuilder(DriverInterface::class)
->getMockForAbstractClass();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->filesystemMock = $this->getMockBuilder(DriverInterface::class)
->getMockForAbstractClass();
$this->filesystemMock = $this->createMock(DriverInterface::class);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ihor-sviziev
Thank you for your notice.
I fixed it.

Comment on lines +97 to +100
'datetime' => DateTime::createFromFormat(
'U.u',
sprintf('%.6F', microtime(true))
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'datetime' => DateTime::createFromFormat(
'U.u',
sprintf('%.6F', microtime(true))
),
'datetime' => DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true))),

int $level = Logger::WARNING,
string $message = 'test',
array $context = []
):array {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
):array {
): array {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ihor-sviziev
Thank you for your notice.
I fixed it.

@eduard13
Copy link
Contributor

@magento run Unit Tests, WebAPI Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

1 similar comment
@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@andrewbess andrewbess force-pushed the improvement/CE-32868-update-monolog-to-latest-version branch from fc32670 to 4eca2e2 Compare July 26, 2021 14:12
@andrewbess
Copy link
Contributor Author

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@andrewbess
Copy link
Contributor Author

The external currency service still unavailable.
api-server-status
So functional tests will be failed with 1 error of "MC-28786: Currency Converter API configuration".
Please don't re-run these tests if it has only one error.

@andrewbess andrewbess merged commit b2a9e91 into magento:platform-health Jul 26, 2021
@m2-assistant
Copy link

m2-assistant bot commented Jul 26, 2021

Hi @andrewbess, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@andrewbess andrewbess deleted the improvement/CE-32868-update-monolog-to-latest-version branch July 29, 2021 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests Award: category of expertise Award: special achievement Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for testing Project: Platform Health
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants