Skip to content

fedotov-as/sfSentryPlugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sfSentryPlugin

Packagist Downloads Latest Stable Version License

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

Requirements

  • PHP ≥ 5.3
  • Symfony ≥ 1.4
  • Sentry instance

Installation

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://public@sentry.example.com: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.

Usage

Sentry

// 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'));

License

FOSSA Status