Nette Documentation Preview

syntax
Tracy Configuration
*******************

Following examples assume the following class alias is defined:

```php
use Tracy\Debugger;
```


Error Logging
-------------

```php
$logger = Debugger::getLogger();

// if error has occurred the notification is sent to this email
$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 it sending by mail()

// after what shortest time to send another email?
$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
-----------------

```php
// maximum string length
Debugger::$maxLength = 150;              // (int) default according to Tracy

// how deep will list
Debugger::$maxDepth = 10;                // (int) default according to Tracy

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

// displays the location where dump() was called?
Debugger::$showLocation = /* ... */;     // (bool) default according to Tracy
```


Others
------

```php
// in Development mode, you will see notice or error warnings as BlueScreen
Debugger::$strictMode = /* ... */;       // (bool|int) defaults to false, you can select only specific error levels (e.g. E_USER_DEPRECATED | E_DEPRECATED)

// displays silent (@) error messages
Debugger::$scream = /* ... */;           // (bool|int) defaults to false, since version 2.9 it is possible to select only specific error levels (e.g. E_USER_DEPRECATED | E_DEPRECATED)

// link format to open 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

// shows 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 the Nette Framework, you can also configure Tracy and add new panels to the Tracy Bar using the configuration file.
You can set the Tracy parameters in the configuration and also add new panels to the Tracy Bar. These settings are applied only after the DI container has been created, so errors that occurred earlier cannot reflect them.

Error logging configuration:

```neon
tracy:
	# if error has occurred the notification is sent to this email
	email: dev@example.com           # (string|string[]) defaults to unset

	# email sender
	fromEmail: robot@example.com     # (string) defaults to unset

	# period of postponement of emails sending (since Tracy 2.8.8)
	emailSnooze: ...                 # (string) defaults to '2 days'

	# to use a mailer defined in the configuration? (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 function `dump()`:

```neon
tracy:
	# maximum string length
	maxLength: 150                # (int) default according to Tracy

	# how deep will list
	maxDepth: 10                  # (int) default according to Tracy

	# 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'

	# displays the location where dump() was called?
	showLocation: ...             # (bool) default according to Tracy
```

To install the Tracy extension:

```neon
tracy:
	# appends bars to Tracy Bar
	bar:
		- Nette\Bridges\DITracy\ContainerPanel
		- IncludePanel
		- XDebugHelper('myIdeKey')
		- MyPanel(@MyService)

	# append panels to BlueScreen
	blueScreen:
		- DoctrinePanel::renderException
```

Other options:

```neon
tracy:
	# in Development mode, you will see notice or error warnings as BlueScreen
	strictMode: ...           # defaults to true

	# displays silent (@) error messages
	scream: ...               # defaults to false

	# link format to open 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

	# shows 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` | [api:Tracy\ILogger] | logger
| `tracy.blueScreen` | [api:Tracy\BlueScreen] | BlueScreen
| `tracy.bar` | [api:Tracy\Bar] | Tracy Bar

Tracy Configuration

Following examples assume the following class alias is defined:

use Tracy\Debugger;

Error Logging

$logger = Debugger::getLogger();

// if error has occurred the notification is sent to this email
$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 it sending by mail()

// after what shortest time to send another email?
$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

// how deep will list
Debugger::$maxDepth = 10;                // (int) default according to Tracy

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

// displays the location where dump() was called?
Debugger::$showLocation = /* ... */;     // (bool) default according to Tracy

Others

// in Development mode, you will see notice or error warnings as BlueScreen
Debugger::$strictMode = /* ... */;       // (bool|int) defaults to false, you can select only specific error levels (e.g. E_USER_DEPRECATED | E_DEPRECATED)

// displays silent (@) error messages
Debugger::$scream = /* ... */;           // (bool|int) defaults to false, since version 2.9 it is possible to select only specific error levels (e.g. E_USER_DEPRECATED | E_DEPRECATED)

// link format to open 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

// shows 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 the Nette Framework, you can also configure Tracy and add new panels to the Tracy Bar using the configuration file. You can set the Tracy parameters in the configuration and also add new panels to the Tracy Bar. These settings are applied only after the DI container has been created, so errors that occurred earlier cannot reflect them.

Error logging configuration:

tracy:
	# if error has occurred the notification is sent to this email
	email: dev@example.com           # (string|string[]) defaults to unset

	# email sender
	fromEmail: robot@example.com     # (string) defaults to unset

	# period of postponement of emails sending (since Tracy 2.8.8)
	emailSnooze: ...                 # (string) defaults to '2 days'

	# to use a mailer defined in the configuration? (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 function dump():

tracy:
	# maximum string length
	maxLength: 150                # (int) default according to Tracy

	# how deep will list
	maxDepth: 10                  # (int) default according to Tracy

	# 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'

	# displays the location where dump() was called?
	showLocation: ...             # (bool) default according to Tracy

To install the Tracy extension:

tracy:
	# appends bars to Tracy Bar
	bar:
		- Nette\Bridges\DITracy\ContainerPanel
		- IncludePanel
		- XDebugHelper('myIdeKey')
		- MyPanel(@MyService)

	# append panels to BlueScreen
	blueScreen:
		- DoctrinePanel::renderException

Other options:

tracy:
	# in Development mode, you will see notice or error warnings as BlueScreen
	strictMode: ...           # defaults to true

	# displays silent (@) error messages
	scream: ...               # defaults to false

	# link format to open 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

	# shows 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