Nette Sentry logger library

2.2.0 2024-01-05 10:53 UTC

This package is auto-updated.

Last update: 2024-05-05 13:18:18 UTC


Build Status

Tracy logger extension capable of logging messages and errors to Sentry.

Note: If you have debug mode enabled in your application, logger will only send \Tracy\Debugger::log() messages to sentry. Any exception ending with Tracy's blue screen is not going to be logged as you can see the exception details directly.


Install package via Composer:

composer require rootpd/nette-sentry


Enable and configure the extension in Nette config file:

	# ...
	sentry: Rootpd\NetteSentry\DI\SentryExtension

    dsn: # required
    environment: production # optional, defaults to "local"
    user_fields: # optional, defaults to empty array; Nette's identity ID is being sent automatically
        - email
    session_sections: # optional, list of session sections to track
        - mySection
        mypriority: warning

Priority-Severity mapping

Sometimes you might need to use custom priority when logging the error in Nette:

\Tracy\Debugger::log('foo', 'mypriority');

Sentry only allows strict set of severities. By default any message with unknown (non-standard) severity is not being logged.

You can map your custom priority to Sentry's severity in config by using priority_mapping as shown in the example.

The allowed set of Sentry severities can be checked in Sentry's PHP repository.


Once enabled as extension, you can continue to throw exceptions without any change. To log message please use \Tracy\Debugger::log() method.