Make LineFormatter::formatException protected
wayne530 opened this issue · comments
Not sure if this has been discussed before and perhaps the cons outweigh the pros, but at present, it is not possible to create a custom line formatter that extends LineFormatter
without reimplementing a lot of business logic because formatException
is private. It seems this might be an area where it is desirable to add custom handling via a custom line formatter. Some libraries or frameworks have custom base exceptions containing additional library-/framework-specific data that for the general case might be too verbose to include in the exception message, but would be useful for some application-specific logging purpose.
One example is Doctrine\DBAL\Exception\DriverException
, which contains the executed query along with parameters, but does not include the query or parameters in the exception message itself.
IMO you can override normalizeException if you want to do this. Because if I open up formatException then we also have to open up stacktracesParser
, etc. I'd rather keep it how it is.