Tracy Configuration
The following examples assume the following class alias is defined:
use Tracy\Debugger;
Error Logging
$logger = Debugger::getLogger();
// email(s) to send error notifications to
$logger->email = 'dev@example.com'; // (string|string[]) defaults to unset
// email sender
$logger->fromEmail = 'me@example.com'; // (string) defaults to unset
// routine for sending email
$logger->mailer = /* ... */; // (callable) default is sending by mail()
// minimum interval for sending further emails?
$logger->emailSnooze = /* ... */; // (string) default is '2 days'
// for which error levels is BlueScreen also logged?
Debugger::$logSeverity = E_WARNING | E_NOTICE; // defaults to 0 (no error level)
dump()
Behavior
// maximum string length
Debugger::$maxLength = 150; // (int) default according to Tracy version
// maximum nesting depth
Debugger::$maxDepth = 10; // (int) default according to Tracy version
// hide values of these keys (since Tracy 2.8)
Debugger::$keysToHide = ['password', /* ... */]; // (string[]) defaults to []
// visual theme (since Tracy 2.8)
Debugger::$dumpTheme = 'dark'; // (light|dark) defaults to 'light'
// display location where dump() was called?
Debugger::$showLocation = /* ... */; // (bool) default according to Tracy version
Others
// in development mode, display errors of type notice or warning as BlueScreen
Debugger::$strictMode = /* ... */; // (bool|int) defaults to false, specific error levels can be selected (e.g. E_USER_DEPRECATED | E_DEPRECATED)
// display silenced (@) error messages?
Debugger::$scream = /* ... */; // (bool|int) defaults to false, since version 2.9 specific error levels can be selected (e.g. E_USER_DEPRECATED | E_DEPRECATED)
// link format for opening in the editor
Debugger::$editor = /* ... */; // (string|null) defaults to 'editor://open/?file=%file&line=%line'
// path to template with custom page for error 500
Debugger::$errorTemplate = /* ... */; // (string) defaults to unset
// show Tracy Bar?
Debugger::$showBar = /* ... */; // (bool) defaults to true
Debugger::$editorMapping = [
// original => new
'/var/www/html' => '/data/web',
'/home/web' => '/srv/html',
];
Nette Framework
If you are using Nette Framework, you can configure Tracy and add new panels to the Tracy Bar using the configuration file. In the configuration, you can set parameters and add new panels to the Tracy Bar. These settings are applied only after the DI container is created, so errors occurring before that cannot reflect them.
Error logging configuration:
tracy:
# email(s) to send error notifications to
email: dev@example.com # (string|string[]) defaults to unset
# email sender
fromEmail: robot@example.com # (string) defaults to unset
# email sending snooze time (since Tracy 2.8.8)
emailSnooze: ... # (string) defaults to '2 days'
# use Nette mailer for sending emails? (since Tracy 2.5)
netteMailer: ... # (bool) defaults to true
# for which error levels is BlueScreen also logged?
logSeverity: [E_WARNING, E_NOTICE] # defaults to []
Configuration for the dump()
function:
tracy:
# maximum string length
maxLength: 150 # (int) default according to Tracy version
# maximum nesting depth
maxDepth: 10 # (int) default according to Tracy version
# hide values of these keys (since Tracy 2.8)
keysToHide: [password, pass] # (string[]) defaults to []
# visual theme (since Tracy 2.8)
dumpTheme: dark # (light|dark) defaults to 'light'
# display location where dump() was called?
showLocation: ... # (bool) default according to Tracy version
Tracy extension installation:
tracy:
# adds panels to Tracy Bar
bar:
- Nette\Bridges\DITracy\ContainerPanel
- IncludePanel
- XDebugHelper('myIdeKey')
- MyPanel(@MyService)
# adds panels to BlueScreen
blueScreen:
- DoctrinePanel::renderException
Other options:
tracy:
# in development mode, display errors of type notice or warning as BlueScreen
strictMode: ... # defaults to true
# display silenced (@) error messages?
scream: ... # defaults to false
# link format for opening in the editor
editor: ... # (string) defaults to 'editor://open/?file=%file&line=%line'
# path to template with custom page for error 500
errorTemplate: ... # (string) defaults to unset
# show Tracy Bar?
showBar: ... # (bool) defaults to true
editorMapping:
# original: new
/var/www/html: /data/web
/home/web: /srv/html
The values of the logSeverity
, strictMode
and scream
options can be written as an array
of error levels (e.g. [E_WARNING, E_NOTICE]
) or as an expression used in PHP (e.g.
E_ALL & ~E_NOTICE
).
DI Services
These services are added to the DI container:
Name | Type | Description |
---|---|---|
tracy.logger |
Tracy\ILogger | logger |
tracy.blueScreen |
Tracy\BlueScreen | BlueScreen |
tracy.bar |
Tracy\Bar | Tracy Bar |