- @if($logEntries)
- @foreach ($logEntries as $logEntry)
-
- {{$logEntry->date}} |
- {{$logEntry->environment}} |
-
- @if($logEntry->level == 'error')
- {{$logEntry->level}}
- @elseif($logEntry->level == 'debug')
- {{$logEntry->level}}
- @else
- {{$logEntry->level}}
- @endif
- |
- {{--{{$logEntry->file_path}} | --}}
- {{ \Illuminate\Support\Str::limit($logEntry->context, 40, ' (...)')}} |
-
- @if($logEntry->stack_traces && $logEntry->stack_traces->count())
- Show stack trace
- @else
- No stacktrace
- @endif
- |
-
+
+ Date: |
+ {{$entry->date}} |
+
+
+ Environment: |
+ {{$entry->environment}} |
+
+
+ Level: |
+ {{$entry->level}} |
+
+
+ Context: |
+ {{$entry->context}} |
+
+
+ Stack trace: |
+
+ @if($entry->stack_traces && $entry->stack_traces->count())
+
+ @foreach ($entry->stack_traces as $st)
+
+
+ Caught at |
+ {{$st->caught_at}} |
+
+
+ In |
+ {{$st->in}} |
+
+
+ Line |
+ {{$st->line}} |
+
+
+ content |
+ {{$st->__toString()}} |
+
+
@endforeach
+
@endif
- |
+
+
+
+
@if ($footer)
diff --git a/resources/views/log-viewer-view.blade.php b/resources/views/log-viewer-view.blade.php
index 936fe17..e29cfb3 100644
--- a/resources/views/log-viewer-view.blade.php
+++ b/resources/views/log-viewer-view.blade.php
@@ -30,18 +30,18 @@
{{$logEntry->environment}} |
@if($logEntry->level == 'error')
- {{$logEntry->level}}
+ {{$logEntry->level}}
@elseif($logEntry->level == 'debug')
- {{$logEntry->level}}
+ {{$logEntry->level}}
@else
- {{$logEntry->level}}
+ {{$logEntry->level}}
@endif
|
{{--{{$logEntry->file_path}} | --}}
{{ \Illuminate\Support\Str::limit($logEntry->context, 40, ' (...)')}} |
- details
+ details
|
diff --git a/src/Pages/LogViewerPage.php b/src/Pages/LogViewerPage.php
index ed2e8e1..3b39b31 100644
--- a/src/Pages/LogViewerPage.php
+++ b/src/Pages/LogViewerPage.php
@@ -21,7 +21,8 @@ class LogViewerPage extends Page implements Tables\Contracts\HasTable
protected static ?string $navigationIcon = 'heroicon-o-document-text';
protected static string $view = 'filament-log-viewer::log-viewer';
-
+ protected static ?string $title = 'Log viewer';
+ protected static ?string $navigationLabel = 'Log viewer';
protected function getActions(): array
{
@@ -59,7 +60,7 @@ protected function getTableActions(): array
Tables\Actions\LinkAction::make('viewlogfile')
->label('View')
->url(function (LogFile $record) {
- return LogViewerViewLogPage::getUrl(['record' => $record]);
+ return LogViewerViewLogPage::getUrl(['fileName' => $record->name]);
})
diff --git a/src/Pages/LogViewerViewDetailsPage.php b/src/Pages/LogViewerViewDetailsPage.php
index 7473ba4..47eefe1 100644
--- a/src/Pages/LogViewerViewDetailsPage.php
+++ b/src/Pages/LogViewerViewDetailsPage.php
@@ -14,12 +14,13 @@
use Rabol\FilamentLogviewer\Models\LogFile;
use Filament\Tables\Concerns\InteractsWithTable;
use Rabol\FilamentLogviewer\Models\LogFileEntry;
-
+use stdClass;
class LogViewerViewDetailsPage extends Page
{
- private $logEntries;
- private $log;
+ private $recordId;
+ private $fileName;
+ private $entry;
protected static ?string $navigationIcon = 'heroicon-o-document-text';
@@ -27,33 +28,35 @@ class LogViewerViewDetailsPage extends Page
protected static bool $shouldRegisterNavigation = false;
- protected static ?string $title = 'test';
+ protected static ?string $title = 'Log details';
protected function getActions(): array
{
return [
ButtonAction::make('back')
->label('Back')
- ->url(LogViewerViewLogPage::getUrl()),
+ ->url(LogViewerViewLogPage::getUrl(['fileName' => $this->fileName])),
];
}
- public function mount(string $record): void
+ public function mount(string $recordId, string $fileName): void
{
- debug($record);
- /*
- $this->log = LogReader::filename($record->name);
- $this->logEntries = $this->log->get(); // we need to paginate...
- self::$title = 'Log file: ' . $record->name;
- */
+ $this->recordId = $recordId;
+ $this->fileName = $fileName;
+
+ $this->entry = LogReader::find($recordId);
+ debug($this->entry);
+ debug($recordId);
+ debug($fileName);
}
protected function getViewData(): array
{
return [
- 'header' => null,
+ 'header' => null, //'Log details: ' . $this->recordId . ' / ' . $this->fileName,
'footer' => null,
- 'logEntries' => $this->logEntries,
- 'log' => $this->log,
+ 'recordid' => $this->recordId,
+ 'filename' => $this->fileName,
+ 'entry' => $this->entry,
];
}
@@ -61,7 +64,7 @@ public static function getRoutes(): Closure
{
return function () {
$slug = static::getSlug();
- Route::get("{$slug}/{record?}", static::class)->name($slug);
+ Route::get("{$slug}/{recordId?}/{fileName?}", static::class)->name($slug);
};
}
}
\ No newline at end of file
diff --git a/src/Pages/LogViewerViewLogPage.php b/src/Pages/LogViewerViewLogPage.php
index e45d64a..b9c2a35 100644
--- a/src/Pages/LogViewerViewLogPage.php
+++ b/src/Pages/LogViewerViewLogPage.php
@@ -20,6 +20,7 @@ class LogViewerViewLogPage extends Page
{
private $logEntries;
private $log;
+ private $fileName;
protected static ?string $navigationIcon = 'heroicon-o-document-text';
@@ -27,7 +28,7 @@ class LogViewerViewLogPage extends Page
protected static bool $shouldRegisterNavigation = false;
- protected static ?string $title = 'test';
+ protected static ?string $title = 'View log file';
protected function getActions(): array
{
return [
@@ -37,11 +38,12 @@ protected function getActions(): array
];
}
- public function mount(LogFile $record): void
+ public function mount(string $fileName): void
{
- $this->log = LogReader::filename($record->name);
+ $this->log = LogReader::filename($fileName);
$this->logEntries = $this->log->get(); // we need to paginate...
- self::$title = 'Log file: ' . $record->name;
+ self::$title = 'Log file: ' . $fileName;
+ $this->fileName = $fileName;
}
protected function getViewData(): array
@@ -51,6 +53,7 @@ protected function getViewData(): array
'footer' => null,
'logEntries' => $this->logEntries,
'log' => $this->log,
+ 'filename' => $this->fileName,
];
}
@@ -58,7 +61,7 @@ public static function getRoutes(): Closure
{
return function () {
$slug = static::getSlug();
- Route::get("{$slug}/{record?}", static::class)->name($slug);
+ Route::get("{$slug}/{fileName?}", static::class)->name($slug);
};
}
}
\ No newline at end of file