-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from netlogix/feature/editorconfig
FEATURE: Add editorconfig & reformat code
- Loading branch information
Showing
13 changed files
with
169 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# The IDE is assumed to use PSR-2 for PHP files. | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
tab_width = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 | ||
tab_width = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
# Netlogix.Sentry | ||
|
||
## About | ||
This package provides a Flow integration for the [sentry.io](https://sentry.io) PHP SDK. Some basic | ||
information about the Flow application is added to the sentry Event by default, but you can easily | ||
configure and extend this package to fit your needs. | ||
|
||
This package provides a Flow integration for the [sentry.io](https://sentry.io) PHP SDK. Some basic information about | ||
the Flow application is added to the sentry Event by default, but you can easily configure and extend this package to | ||
fit your needs. | ||
|
||
## Installation | ||
|
||
`composer require netlogix/sentry` | ||
|
||
Currently the following Flow versions are supported: | ||
|
@@ -17,29 +19,32 @@ Currently the following Flow versions are supported: | |
## Setup | ||
|
||
The sentry DSN Client Key has to be configured. Get it from your project settings (SDK Setup -> Client Keys (DSN)). | ||
|
||
```yaml | ||
Netlogix: | ||
Sentry: | ||
dsn: 'https://[email protected]/123456789' | ||
``` | ||
Then simply run `./flow sentry:test` to log an exception to sentry. | ||
While this is technically all you **have to** do, you might want to adjust the providers - see below. | ||
Then simply run `./flow sentry:test` to log an exception to sentry. While this is technically all you **have to** do, | ||
you might want to adjust the providers - see below. | ||
|
||
## Configuration | ||
|
||
This package allows you to configure which data should be added to the sentry event by changing the providers | ||
for each scope. Currently, the available scopes are `environment`, `extra`, `release`, `tags` and `user`. | ||
|
||
Providers can be sorted using the [PositionalArraySorter](https://github.com/neos/utility-arrays/blob/master/Classes/PositionalArraySorter.php#L15) position strings. | ||
For the scopes `extra`, `tags` and `user`, all data provided will be merged together. The scopes `environment` and `release` only support a **single** value (you can still configure more than one provider, but the last one wins). | ||
This package allows you to configure which data should be added to the sentry event by changing the providers for each | ||
scope. Currently, the available scopes are `environment`, `extra`, `release`, `tags` and `user`. | ||
|
||
Providers can be sorted using | ||
the [PositionalArraySorter](https://github.com/neos/utility-arrays/blob/master/Classes/PositionalArraySorter.php#L15) | ||
position strings. For the scopes `extra`, `tags` and `user`, all data provided will be merged together. The | ||
scopes `environment` and `release` only support a **single** value (you can still configure more than one provider, but | ||
the last one wins). | ||
|
||
```yaml | ||
Netlogix: | ||
Sentry: | ||
scope: | ||
extra: [] | ||
extra: [ ] | ||
release: | ||
# If you don't need a specific order, you can simply set the provider to true | ||
|
@@ -57,8 +62,10 @@ Netlogix: | |
``` | ||
|
||
## Environments | ||
The sentry SDK will search for the environment variable `SENTRY_ENVIRONMENT` and use it's value as the current environment. This is still the default, however | ||
you can configure the `Netlogix\Sentry\Scope\Environment\FlowSettings` provider to use a different value: | ||
|
||
The sentry SDK will search for the environment variable `SENTRY_ENVIRONMENT` and use it's value as the current | ||
environment. This is still the default, however you can configure the `Netlogix\Sentry\Scope\Environment\FlowSettings` | ||
provider to use a different value: | ||
|
||
```yaml | ||
Netlogix: | ||
|
@@ -68,10 +75,11 @@ Netlogix: | |
``` | ||
|
||
## Release tracking | ||
You can use the `Netlogix\Sentry\Scope\Release\PathPattern` `ReleaseProvider` to extract your current release from | ||
the app directory. By default, the configured `pathPattern` is matched against the `FLOW_PATH_ROOT` constant: | ||
|
||
````yaml | ||
You can use the `Netlogix\Sentry\Scope\Release\PathPattern` `ReleaseProvider` to extract your current release from the | ||
app directory. By default, the configured `pathPattern` is matched against the `FLOW_PATH_ROOT` constant: | ||
|
||
```yaml | ||
Netlogix: | ||
Sentry: | ||
|
@@ -83,10 +91,10 @@ Netlogix: | |
# Pattern to extract current release from file path | ||
# This pattern is matched against pathToMatch | ||
pathPattern: '~/releases/(\d{14})$~' | ||
```` | ||
``` | ||
|
||
You can also use the `Netlogix\Sentry\Scope\Release\FlowSettings` to set the Release | ||
through Flow Configuration (`Netlogix.Sentry.release.setting`, set to `%env:SENTRY_RELEASE%` by default). | ||
You can also use the `Netlogix\Sentry\Scope\Release\FlowSettings` to set the Release through Flow | ||
Configuration (`Netlogix.Sentry.release.setting`, set to `%env:SENTRY_RELEASE%` by default). | ||
|
||
## Custom Providers | ||
|
||
|
@@ -101,6 +109,7 @@ For each scope, you can implement your own providers. Each scope requires it's o | |
Then simply add them to the configuration. | ||
|
||
If you need access to the thrown exception, you can check `Netlogix\Sentry\Scope\ScopeProvider::getCurrentThrowable()`: | ||
|
||
```php | ||
<?php | ||
|
@@ -167,8 +176,8 @@ class LoggingManually { | |
|
||
## Ignoring exceptions | ||
|
||
If you need to skip sending a specific exception to sentry, you can use Flow's `renderingGroups`. Simply create one | ||
that matches your exception and set `logException` to `false`: | ||
If you need to skip sending a specific exception to sentry, you can use Flow's `renderingGroups`. Simply create one that | ||
matches your exception and set `logException` to `false`: | ||
|
||
```yaml | ||
Neos: | ||
|
@@ -178,8 +187,8 @@ Neos: | |
renderingGroups: | ||
ignoredExceptions: | ||
matchingStatusCodes: [418] | ||
matchingExceptionClassNames: ['Your\Ignored\Exception'] | ||
matchingStatusCodes: [ 418 ] | ||
matchingExceptionClassNames: [ 'Your\Ignored\Exception' ] | ||
options: | ||
logException: false | ||
``` | ||
|
Oops, something went wrong.