Skip to content

Commit

Permalink
Add config to log console commands
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioribeiro committed Jul 31, 2017
1 parent 140ccea commit 3031619
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Tracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ protected function isTrackable()
{
return $this->config->get('enabled') &&
$this->logIsEnabled() &&
$this->notConsole() &&
$this->allowConsole() &&
$this->parserIsAvailable() &&
$this->isTrackableIp() &&
$this->isTrackableEnvironment() &&
Expand Down Expand Up @@ -400,9 +400,12 @@ public function pageViewsByCountry($minutes, $results = true)
return $this->dataRepositoryManager->pageViewsByCountry(Minutes::make($minutes), $results);
}

public function notConsole()
public function allowConsole()
{
return $this->laravel->runningInConsole();
return
(! $this->laravel->runningInConsole()) ||
$this->config->get('console_log_enabled', false)
;
}

public function parserIsAvailable()
Expand Down
5 changes: 5 additions & 0 deletions src/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
*/
'log_enabled' => false,

/*
* Log artisan commands?
*/
'console_log_enabled' => false,

/*
* Log SQL queries?
*
Expand Down

0 comments on commit 3031619

Please sign in to comment.