Skip to content

Commit 12cda93

Browse files
committed
ICL: Error handling minor refactoring.
1 parent 815b586 commit 12cda93

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/Log/ExceptionHandler.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@
44

55
use App\Exceptions\Handler;
66
use Exception;
7-
use Monolog\ErrorHandler;
87

98
class ExceptionHandler extends Handler
109
{
1110
public function __construct()
1211
{
13-
$log = app('log.icl');
14-
ErrorHandler::register($log);
15-
16-
parent::__construct($log);
12+
parent::__construct(app('log.icl'));
1713
}
1814

1915
public function report(Exception $e)

src/Loggable.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Support\Str;
77
use Illuminated\Console\Log\ExceptionHandler;
88
use Illuminated\Console\Log\Formatter;
9+
use Monolog\ErrorHandler;
910
use Monolog\Handler\RotatingFileHandler;
1011
use Monolog\Logger;
1112
use Symfony\Component\Console\Input\InputInterface;
@@ -24,7 +25,7 @@ protected function initialize(InputInterface $input, OutputInterface $output)
2425

2526
protected function initializeLogging()
2627
{
27-
$this->initializeLoggingBindings();
28+
$this->initializeErrorHandling();
2829

2930
$class = get_class($this);
3031
$host = gethostname();
@@ -42,13 +43,15 @@ protected function initializeLogging()
4243
}
4344
}
4445

45-
private function initializeLoggingBindings()
46+
private function initializeErrorHandling()
4647
{
4748
app()->singleton('log.icl', function () {
4849
return new Logger('ICL', $this->getLogHandlers());
4950
});
5051
$this->icl = app('log.icl');
5152

53+
ErrorHandler::register($this->icl);
54+
5255
app()->singleton(ExceptionHandlerContract::class, ExceptionHandler::class);
5356
}
5457

0 commit comments

Comments
 (0)