From 74195cb1ef741ec1037156c339109e6a6ba6a74a Mon Sep 17 00:00:00 2001 From: horus Date: Thu, 17 Nov 2022 20:25:57 +0100 Subject: Capture output from scheduler tasks --- app/Console/Commands/SaveStats.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'app/Console/Commands/SaveStats.php') diff --git a/app/Console/Commands/SaveStats.php b/app/Console/Commands/SaveStats.php index 3466812..8af214b 100644 --- a/app/Console/Commands/SaveStats.php +++ b/app/Console/Commands/SaveStats.php @@ -28,10 +28,22 @@ class SaveStats extends Command */ public function handle() { + ob_start(); + $background = new Background(); - if ( $background->saveAnimeStats() ) { + $ok = $background->saveAnimeStats(); + + $msg = ob_get_contents(); + ob_end_clean(); + + if ( $ok ) { + $this->info( $msg ); return Command::SUCCESS; } + + $this->error( "Failure happened:\n" ); + $this->error( $msg ); + return Command::FAILURE; } } -- cgit v1.2.3