Download the PHP package tmountjr/muted-log without Composer
On this page you can find all versions of the php package tmountjr/muted-log. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tmountjr/muted-log
More information about tmountjr/muted-log
Files in tmountjr/muted-log
Package muted-log
Short Description Provides a "muted" log writer. The primary purpose is to log exceptions without including parameters in the stack trace.
License MIT
Homepage https://github.com/tmountjr/muted-log
Informations about the package muted-log
Muted Log
Introduction
This package extends Laravel's built-in logging facility to ensure that parameters are not included in the stack trace when calling monolog
. Consider the following example code:
The error log will contain the parameter within the stack trace:
By replacing the exception with an instance of MutedException
from this package, the stack trace will not contain the actual parameter values:
Note how the argument 'cleartext parameter'
was replaced with [string]
.
Installation
Install using composer: composer require tmountjr/muted-log
After installing the package, make the following changes in app/config/app.php
:
Note that you need to replace the current alias for Log
with the facade from this package.
Usage
No specific action is required to use this package. Once Laravel's built-in Log
facade is changed, anytime an exception is written to the log, it will be written using the MutedException. Note that this does not cover xdebug stack traces printed to the screen.
Debugging Considerations
Clearly you should not be including stack traces with passwords or credit card information in your production logs. However, it may be useful to leave detailed stack traces turned on in pre-production environments, as long as you are not using actual sensitive data in your development environment. You can override which facade is used on a per-environment basis by changing the alias
directive in app/config/app.php
(which will set the alias globally) and then overriding this behavior in app/config/[environment]/app.php
where [environment]
is an environment found in bootstrap/start.php
:
License
MutedLog is open-sourced software licensed under the MIT license.