Skip to content

Commit d88fd69

Browse files
Merge pull request #9 from SamueleMartini/main
Moved custom log file from concrete implementation to dependency inje…
2 parents c9ab6f7 + adf62c3 commit d88fd69

File tree

5 files changed

+20
-18
lines changed

5 files changed

+20
-18
lines changed

Controller/Adminhtml/Reports/Delete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace GhostUnicorns\WebapiLogs\Controller\Adminhtml\Reports;
1010

1111
use Exception;
12-
use GhostUnicorns\WebapiLogs\Model\Log\Logger;
12+
use Psr\Log\LoggerInterface as Logger;
1313
use GhostUnicorns\WebapiLogs\Model\ResourceModel\Entity\LogCollectionFactory;
1414
use Magento\Backend\App\Action;
1515
use Magento\Backend\App\Action\Context;

Model/Clean.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use DateTime;
1212
use Exception;
13-
use GhostUnicorns\WebapiLogs\Model\Log\Logger;
13+
use Psr\Log\LoggerInterface as Logger;
1414
use GhostUnicorns\WebapiLogs\Model\ResourceModel\Entity\LogCollectionFactory;
1515
use GhostUnicorns\WebapiLogs\Model\ResourceModel\LogResourceModel;
1616

Model/Log/Logger.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

Model/LogHandle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace GhostUnicorns\WebapiLogs\Model;
1010

1111
use Exception;
12-
use GhostUnicorns\WebapiLogs\Model\Log\Logger;
12+
use Psr\Log\LoggerInterface as Logger;
1313
use GhostUnicorns\WebapiLogs\Model\ResourceModel\LogResourceModel;
1414

1515
class LogHandle

etc/di.xml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
88
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
99
<!-- Log start -->
10-
<type name="GhostUnicorns\WebapiLogs\Model\Log\Logger">
10+
<virtualType name="GhostUnicorns\WebapiLogs\Model\Log\Logger" type="Magento\Framework\Logger\Monolog">
1111
<arguments>
1212
<argument name="name" xsi:type="string">GhostUnicorns::WebapiLogs</argument>
1313
<argument name="handlers" xsi:type="array">
@@ -16,12 +16,27 @@
1616
</item>
1717
</argument>
1818
</arguments>
19-
</type>
19+
</virtualType>
2020
<virtualType name="GhostUnicorns\WebapiLogs\Log\Handler" type="Magento\Framework\Logger\Handler\Base">
2121
<arguments>
2222
<argument name="fileName" xsi:type="string">/var/log/webapi_logs.log</argument>
2323
</arguments>
2424
</virtualType>
25+
<type name="GhostUnicorns\WebapiLogs\Model\LogHandle">
26+
<arguments>
27+
<argument name="logger" xsi:type="object">GhostUnicorns\WebapiLogs\Model\Log\Logger</argument>
28+
</arguments>
29+
</type>
30+
<type name="GhostUnicorns\WebapiLogs\Model\Clean">
31+
<arguments>
32+
<argument name="logger" xsi:type="object">GhostUnicorns\WebapiLogs\Model\Log\Logger</argument>
33+
</arguments>
34+
</type>
35+
<type name="GhostUnicorns\WebapiLogs\Controller\Adminhtml\Reports\Delete">
36+
<arguments>
37+
<argument name="logger" xsi:type="object">GhostUnicorns\WebapiLogs\Model\Log\Logger</argument>
38+
</arguments>
39+
</type>
2540
<!-- Log end -->
2641

2742
<!-- Command start -->

0 commit comments

Comments
 (0)