Closed johnpuddephatt closed 2 years ago
I was looking into displaying log messages on my Nova dashboard using the new Table metric introduced in V4.
I took a look at how this package gets data from logs and realised I could piggyback off it very easily!
Below is all that was needed to display the latest three lines from laravel.log (this is from the 'calculate' method of my table metric)
$lines = array_slice(Stepanenko3\LogsTool\LogsService::all("laravel.log"), 0, 3); foreach ($lines as $line) { $rows[] = MetricTableRow::make() ->icon( $line["level_img"] ) ->iconClass( $line["level_class"] ) ->title($line["text"]) ->subtitle( \Carbon\Carbon::create($line["date"])->diffForHumans() ); } return $rows;
and here's the result:
@johnpuddephatt, thank you so much for your idea
I'll write it down to README a little later Or you can open PR
@johnpuddephatt, I added it to README
Thanks for the idea
I was looking into displaying log messages on my Nova dashboard using the new Table metric introduced in V4.
I took a look at how this package gets data from logs and realised I could piggyback off it very easily!
Below is all that was needed to display the latest three lines from laravel.log (this is from the 'calculate' method of my table metric)
and here's the result: