Skip to content

Commit

Permalink
Added possibility to disable logs in specific environments.
Browse files Browse the repository at this point in the history
  • Loading branch information
gent-fella-health committed Dec 16, 2020
1 parent 065f97e commit a9f91d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion config/laralog.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,12 @@
* This is the database connection that will be used by the migration and
* the LaraLog model shipped with this package.
*/
'database_connection' => 'mysql'
'database_connection' => 'mysql',


/*
* If you want to disable logs in specific environments this is
* the exactly place.
*/
'disable_on_environments' => ['local'],
];
4 changes: 4 additions & 0 deletions src/Traits/ModelEventLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ protected function attributesShouldBeLogged()

protected static function allowLogs()
{
if (in_array(app()->environment(), config('laralog.disable_on_environments'))) {
return false;
}

if (isset(static::$allowLogs)) {
return static::$allowLogs;
}
Expand Down

0 comments on commit a9f91d6

Please sign in to comment.