Enable remote logging to Sentry into Symfony1 applications.
Listens to events:
- Fatal errors (syntax error, out of memory)
- Warnings (undefined variable, headers sent, deprecated)
- Exceptions
Support for sending custom events:
- Exceptions
- Messages with any error level
- PHP ≥ 5.3
- Symfony ≥ 1.4
- Sentry instance
With composer
composer require mezonix/sf-sentry-plugin
Add to your project configuration:
# config/ProjectConfiguration.php
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
$this->enablePlugins(array(
// ...
'sfSentryPlugin',
));
}
}
Configure the Sentry client. The DSN can be found in the Sentry interface.
# config/sentry.yml
all:
client:
dsn: http://[email protected]:9000/[PROJECT_ID]
options:
release: ~
exclude:
- sfStopException
auto_log_stacks: true
dsn
- Sentry connection URL.options/release
- Release version or tag name.options/exclude
- List of exception classes that are ignored.options/auto_log_stacks
- Generates a backtrace. See debug-backtrace.
// send debug message
Sentry::sendDebug('Debug message text');
// send information message
Sentry::sendInfo('Information message text');
// send warning message
Sentry::sendWarn('Warning message text');
// send error message
Sentry::sendError('Error message text');
// send error message with variables
Sentry::sendError('Error message text', array('foo' => 'bar'));
// send exception
Sentry::sendException(new Exception('Exception message'));
// send exception with variables
Sentry::sendException(new Exception('Exception message'), array('foo' => 'bar'));