diff --git a/readme.md b/readme.md index 2c8216d40..46253c3e0 100644 --- a/readme.md +++ b/readme.md @@ -171,11 +171,11 @@ generates the output: ![dump](https://nette.github.io/tracy/images/tracy-dump.png) -You can also change the nesting depth by `Debugger::$maxDepth` and displayed strings length by `Debugger::$maxLen`. Naturally, lower values accelerate Tracy rendering. +You can also change the nesting depth by `Debugger::$maxDepth` and displayed strings length by `Debugger::$maxLength`. Naturally, lower values accelerate Tracy rendering. ```php Debugger::$maxDepth = 2; // default: 3 -Debugger::$maxLen = 50; // default: 150 +Debugger::$maxLength = 50; // default: 150 ``` The `dump()` function can display other useful information. `Tracy\Dumper::LOCATION_SOURCE` adds tooltip with path to the file, where the function was called. `Tracy\Dumper::LOCATION_LINK` adds a link to the file. `Tracy\Dumper::LOCATION_CLASS` adds a tooltip to every dumped object containing path to the file, in which the object's class is defined. All these constants can be set in `Debugger::$showLocation` variable before calling the `dump()`. You can set multiple values at once using the `|` operator. diff --git a/src/Tracy/Debugger.php b/src/Tracy/Debugger.php index 6428a85f8..5584a81c4 100644 --- a/src/Tracy/Debugger.php +++ b/src/Tracy/Debugger.php @@ -58,11 +58,14 @@ class Debugger public static $maxDepth = 3; /** @var int how long strings display {@link Debugger::dump()} */ - public static $maxLen = 150; + public static $maxLength = 150; /** @var bool display location? {@link Debugger::dump()} */ public static $showLocation = FALSE; + /** @deprecated */ + public static $maxLen = 150; + /********************* logging ****************d*g**/ /** @var string name of the directory where errors should be logged */ @@ -140,6 +143,7 @@ public static function enable($mode = NULL, $logDirectory = NULL, $email = NULL) self::$productionMode = is_bool($mode) ? $mode : !self::detectDebugMode($mode); } + self::$maxLen = & self::$maxLength; self::$reserved = str_repeat('t', 3e5); self::$time = isset($_SERVER['REQUEST_TIME_FLOAT']) ? $_SERVER['REQUEST_TIME_FLOAT'] : microtime(TRUE); self::$obLevel = ob_get_level(); @@ -506,14 +510,14 @@ public static function dump($var, $return = FALSE) ob_start(function () {}); Dumper::dump($var, [ Dumper::DEPTH => self::$maxDepth, - Dumper::TRUNCATE => self::$maxLen, + Dumper::TRUNCATE => self::$maxLength, ]); return ob_get_clean(); } elseif (!self::$productionMode) { Dumper::dump($var, [ Dumper::DEPTH => self::$maxDepth, - Dumper::TRUNCATE => self::$maxLen, + Dumper::TRUNCATE => self::$maxLength, Dumper::LOCATION => self::$showLocation, ]); } @@ -554,7 +558,7 @@ public static function barDump($var, $title = NULL, array $options = NULL) } $panel->data[] = ['title' => $title, 'dump' => Dumper::toHtml($var, (array) $options + [ Dumper::DEPTH => self::$maxDepth, - Dumper::TRUNCATE => self::$maxLen, + Dumper::TRUNCATE => self::$maxLength, Dumper::LOCATION => self::$showLocation ?: Dumper::LOCATION_CLASS | Dumper::LOCATION_SOURCE, ])]; }