exception_log_tree_formatter
The module enhances log messages to reveal previous exceptions in a nice graphical format.
It attempts to solve for #3582388: Error::logException() should log previous exceptions.
The backtraces of the current exception and all previous exceptions are combined into a visual tree structure.
Features
The module decorates existing loggers to alter the messages.
Whenever a message was logged with `Error::logException()`, it replaces the `@backtrace_string` placeholder with a tree structure like this:
(The line formatters can be swapped out to show methods, classes or other things.)
x DomainException
| Failed to purchase the product.
|
| x Caused by: EntityStorageException
| | Failed to save the entity.
| |
| | x Caused by: DatabaseException
| | | Duplicate primary key.
| | |
| | * path/to/Database.php:384
| | * path/to/InsertQuery.php:123
| |/
| * path/to/EntityStorage.php:715
| * path/to/Entity.php:33
|/
* path/to/Shop.php:444
* index.php:20
Post-Installation
Just enable the module, and the behavior will apply to any logger.
(Not tested with monolog module yet, try for yourself)
Stability?
There will be breaking API changes while this is a sandbox module.
I might rename classes, or even the entire module.