Skip to content

Commit f237306

Browse files
committed
Merge branch 'release/0.5.0'
2 parents 5b45bcc + 0f43a6f commit f237306

File tree

5 files changed

+19
-24
lines changed

5 files changed

+19
-24
lines changed

Helper/Data.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Magento\Framework\App\Helper\Context;
99
use Magento\Store\Model\StoreManagerInterface;
1010
use Magento\Framework\App\Helper\AbstractHelper;
11+
use Magento\Framework\Exception\LocalizedException;
1112
use Magento\Framework\App\ProductMetadataInterface;
1213

1314
class Data extends AbstractHelper
@@ -46,11 +47,7 @@ class Data extends AbstractHelper
4647
* @param StoreManagerInterface $storeManager
4748
* @param State $appState
4849
*/
49-
public function __construct(
50-
Context $context,
51-
StoreManagerInterface $storeManager,
52-
State $appState,
53-
ProductMetadataInterface $productMetadataInterface
50+
public function __construct(Context $context, StoreManagerInterface $storeManager, State $appState, ProductMetadataInterface $productMetadataInterface
5451
) {
5552
$this->storeManager = $storeManager;
5653
$this->appState = $appState;
@@ -102,13 +99,6 @@ public function collectModuleConfig()
10299
*/
103100
public function isActive()
104101
{
105-
try {
106-
$this->appState->setAreaCode(Area::AREA_GLOBAL);
107-
} catch (\Magento\Framework\Exception\LocalizedException $e) {
108-
// intentionally left empty
109-
// var_dump($e);
110-
}
111-
112102
return (! empty($this->config) && array_key_exists('enabled', $this->config) && $this->config['enabled'] && ($this->isProductionMode() || $this->isOverwriteProductionMode()));
113103
}
114104

@@ -117,7 +107,7 @@ public function isActive()
117107
*/
118108
public function isProductionMode()
119109
{
120-
return $this->getAppState() == 'production';
110+
return $this->appState->emulateAreaCode(Area::AREA_GLOBAL, [$this, 'getAppState']) == 'production';
121111
}
122112

123113
/**

Model/SentryLog.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class SentryLog extends Monolog
4040
public function __construct(
4141
$name,
4242
Data $data,
43-
Session $customerSession,
43+
Session\Proxy $customerSession,
4444
array $handlers = [],
4545
array $processors = []
4646
) {
@@ -61,7 +61,10 @@ public function send($message, $logLevel, Monolog $monolog, $context = [])
6161
$config = $this->data->collectModuleConfig();
6262

6363
if ($logLevel >= (int) $config['log_level']) {
64-
$client = (new Raven_Client($config['domain'] ?? null));
64+
$client = new Raven_Client($config['domain'] ?? null, [
65+
'ignore_server_port' => true,
66+
'curl_method' => 'async'
67+
]);
6568
$handler = new RavenHandler($client, $config['log_level'] ?? Logger::ERROR);
6669
$tags = $this->getTags();
6770
$userData = $this->getUserData();

Plugin/ExceptionCatcher.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ class ExceptionCatcher
4141
* @param State $state
4242
* @param SentryLog $logger
4343
*/
44-
public function __construct(
45-
Data $data,
46-
Monolog $monolog,
47-
SentryLog $sentryLog
48-
) {
44+
public function __construct(Data $data, Monolog $monolog, SentryLog $sentryLog) {
4945
$this->sentryHelper = $data;
5046
$this->monolog = $monolog;
5147
$this->sentryLog = $sentryLog;

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ This Magento 2 module integrates the [Sentry sdk](https://github.com/getsentry/s
55
## Installation
66
- `composer require justbetter/magento2-sentry`
77
- `bin/magento module:enable JustBetter_Sentry`
8-
- `bin/magento setup:upgrade && bin/magento setup:static-content:deploy`
8+
- `bin/magento setup:upgrade`
9+
- `bin/magento setup:di:compile`
10+
- `bin/magento setup:static-content:deploy`
911

1012
## Configuration
1113
- Options for the module are defined in the backend under Stores > Configuration > JustBetter > Sentry configuration
@@ -14,14 +16,18 @@ This Magento 2 module integrates the [Sentry sdk](https://github.com/getsentry/s
1416
- Optional you can configure custom error pages in pub/errors. You can use the sentry feedback form and insert here the sentry log ID. The Sentry Log Id is captured in de customer session and can be retrieved in `processor.php`. Soon I'll integrate this in the module.
1517

1618
## Compability
17-
The module is tested on Magento version 2.1.x & 2.2.x with sentry sdk version 1.9.x
19+
The module is tested on Magento version 2.2.x & 2.3.x with sentry sdk version 1.10.x. Magento 2.1.x is not supported by us anymore, feel free to fork this project or make a pull request.
1820

1921
## Ideas, bugs or suggestions?
2022
Please create a [issue](https://github.com/justbetter/magento2-sentry/issues) or a [pull request](https://github.com/justbetter/magento2-sentry/pulls).
2123

2224
## Todo
2325
- Integrate custom error pages in composer package
2426
- Integrate feedback sentry form in error pages
27+
- Integrate Raven Client options describe here: [sentry-php](https://github.com/getsentry/sentry-php/blob/master/docs/config.rst)
28+
29+
## Abous Us
30+
We're a innovative development agency from The Netherlands building awesome websites, webshops and web applications with Laravel and Magento. Check out our website [justbetter.nl](https://justbetter.nl) and our open source projects at [GitHub](https://github.com/justbetter)
2531

2632
## License
2733
[MIT](LICENSE)

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"name": "justbetter/magento2-sentry",
33
"description": "Magento 2 Logger for Sentry",
44
"type": "magento2-module",
5-
"version": "0.4.2",
5+
"version": "0.5.0",
66
"license": "MIT",
77
"require": {
88
"php": ">=7.0",
9-
"sentry/sentry": "^1.9",
9+
"sentry/sentry": "^1.10",
1010
"monolog/monolog": "*",
1111
"magento/framework": "*"
1212
},

0 commit comments

Comments
 (0)