Skip to content

Commit

Permalink
docs and more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrii Afanasiev committed Apr 5, 2018
1 parent bc80685 commit a2537ef
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 9 deletions.
11 changes: 5 additions & 6 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class Configuration implements ConfigurationInterface
];

public static $autoInstrument = [
'network' => true,
'log' => true,
'dom' => true,
'navigation' => true,
'connectivit' => true,
'network' => true,
'log' => true,
'dom' => true,
'navigation' => true,
'connectivity' => true,
];

/**
Expand Down Expand Up @@ -149,7 +149,6 @@ public function getConfigTreeBuilder()
->end()
->scalarNode('verbose')->defaultFalse()->end()
->scalarNode('async')->defaultTrue()->end()
->scalarNode('autoInstrument')->defaultTrue()->end()
->arrayNode('autoInstrument')
->treatNullLike([])
->prototype('scalar')->end()
Expand Down
32 changes: 30 additions & 2 deletions Resources/doc/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,26 @@ Simple configuration of bundle:
send_message_trace: false
include_raw_request_body: false
local_vars_dump: false
rollbar_js:
enabled: true
accessToken: 'some-public-token'
captureUncaught: true
uncaughtErrorLevel: 'error'
captureUnhandledRejections: true
payload:
environment: environment: '%kernel.environment%'
ignoredMessages: []
verbose: false
async: true
autoInstrument:
network: true
log: true
dom: true
navigation: true
connectivity: true
itemsPerMinute: 60
maxItems: 0
scrubFields: ['passwd', 'password', 'secret', 'confirm_password', 'password_confirmation', 'auth_token', 'csrf_token']
Bundle configuration
--------------------
Expand All @@ -61,7 +81,7 @@ in `official documentation`_ for Rollbar PHP lib.
.. _`official documentation`: https://rollbar.com/docs/notifier/rollbar-php/

RollBar - Settings
--------------------
------------------

Here you can description of some important configuration options for RollBar.

Expand All @@ -75,7 +95,7 @@ Here you can description of some important configuration options for RollBar.


RollBar - Person Tracking
--------------------
-------------------------
Rollbar `can track`_ which of your People (users) are affected by each error. There is one of the options:

``person_fn``: A function reference (string, etc. - anything that `call_user_func()`_ can handle) returning an array like the one for 'person'.
Expand Down Expand Up @@ -122,3 +142,11 @@ Than in your ``PersonProvider`` class/service or function you have to return use
.. _`can track`: https://rollbar.com/docs/person-tracking/
.. _`call_user_func()`: http://php.net/call_user_func

RollBarJS - Integration
-----------------------
It's possible to use `Rollbar for JavaScript`_ integration in your project. The basic configuration is assailable in configuration for current bundle.

Inject following ``{{ rollbarJs() }}`` code into the <head> of every page you want to monitor. It should be as high as possible, before any other <script> tags.

.. _`Rollbar for JavaScript`: https://rollbar.com/docs/notifier/rollbar.js/
19 changes: 19 additions & 0 deletions Tests/Fixtures/app/config/config_test_drbj.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
imports:
- { resource: config.yml }
- { resource: parameters.yml }

symfony_rollbar:
enable: true
exclude:
- \Symfony\Component\Debug\Exception\FatalErrorException
- \SymfonyRollbarBundle\Tests\Fixtures\MyAwesomeException
- \ParseError
rollbar:
access_token: 'SOME_ROLLBAR_ACCESS_TOKEN_123456'
environment: '%kernel.environment%'

rollbar_js:
enabled: false
accessToken: 'SOME_ROLLBAR_ACCESS_TOKEN_654321'
payload:
environment: '%kernel.environment%'
1 change: 1 addition & 0 deletions Tests/SymfonyRollbarBundle/Twig/RollbarExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function generatorRollbarEnv()
// env, is-empty-functions
['test', false],
['test_drb', true],
['test_drbj', true],
];
}
}
6 changes: 5 additions & 1 deletion Twig/RollbarExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ public function __construct(ContainerInterface $container)
$this->container = $container;

try {
$this->config = $container->getParameter(SymfonyRollbarExtension::ALIAS . '.config');
$config = $container->getParameter(SymfonyRollbarExtension::ALIAS . '.config');

if (!empty($config['rollbar_js']['enabled'])) {
$this->config = $config;
}
} catch (\Exception $e) {
return null;
}
Expand Down

0 comments on commit a2537ef

Please sign in to comment.