Tracy-Konfiguration
Die folgenden Beispiele gehen davon aus, dass der folgende Klassenalias definiert ist:
use Tracy\Debugger;
Fehlerprotokollierung
$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()
Verhalten
// 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
Andere
// 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 Rahmenwerk
Wenn Sie das Nette Framework verwenden, können Sie Tracy auch über die Konfigurationsdatei konfigurieren und der Tracy-Leiste neue Felder hinzufügen. Sie können die Tracy-Parameter in der Konfiguration einstellen und der Tracy-Leiste auch neue Panels hinzufügen. Diese Einstellungen werden erst nach der Erstellung des DI-Containers angewendet, so dass Fehler, die vorher aufgetreten sind, nicht berücksichtigt werden können.
Konfiguration der Fehlerprotokollierung:
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 []
Konfiguration für die Funktion 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
So installieren Sie die Tracy-Erweiterung:
tracy:
# appends bars to Tracy Bar
bar:
- Nette\Bridges\DITracy\ContainerPanel
- IncludePanel
- XDebugHelper('myIdeKey')
- MyPanel(@MyService)
# append panels to BlueScreen
blueScreen:
- DoctrinePanel::renderException
Andere Optionen:
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
Die Werte der Optionen logSeverity
, strictMode
und scream
können als ein Array von
Fehlerstufen (z.B. [E_WARNING, E_NOTICE]
) oder als ein in PHP verwendeter Ausdruck (z.B.
E_ALL & ~E_NOTICE
).
DI-Dienste
Diese Dienste werden dem DI-Container hinzugefügt:
Name | Typ | Beschreibung |
---|---|---|
tracy.logger |
Tracy\ILogger | logger |
tracy.blueScreen |
Tracy\BlueScreen | BlueScreen |
tracy.bar |
Tracy\Bar | Tracy Bar |