diff --git a/app/Console/Commands/BaseScheduleCommand.php b/app/Console/Commands/BaseScheduleCommand.php new file mode 100644 index 0000000..0b9e279 --- /dev/null +++ b/app/Console/Commands/BaseScheduleCommand.php @@ -0,0 +1,48 @@ +logExecErr($th); + } + } + + + /** + * Метод логирования ошибки выполнения скриптов по расписанию + * + * @param \Throwable $th + * @return void + */ + private function logExecErr(\Throwable $th): void + { + $context = [ + //Скрипт откуда запустилась задача + 'command' => static::class, + //Скрипт, в котором произошла ошибка + 'file' => $th->getFile(), + 'line' => $th->getLine(), + ]; + \Log::channel('schedule_err')->error($th->getMessage(), $context); + } +}