Skip to content

Commit

Permalink
added view errors only from log #81
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickakk committed Nov 4, 2024
1 parent 76bd5ff commit 639c751
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Updated dependencies
- Updated Composer to 2.8.2
- Remove email addresses from api output #109
- Added possibility to view errors only from the log #81

### Bug fix
- Fix: Course start dates are shown earlier in different timezone #113
Expand Down
27 changes: 27 additions & 0 deletions src/Controller/LogentriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,32 @@ public function index()
$query = $this->Logentries->find('all', ['order' => ['Logentries.id' => 'DESC']])->contain(['LogentryCodes', 'Users']);
$this->set('logentries', $this->paginate($query));
$this->set(compact('user')); // required for contributors menu
$this->render('show-entries');
}

public function errors()
{
$user = $this->Authentication->getIdentity();
if (!$user->is_admin) {
$this->Flash->error(__('Not authorized to logentries errors'));
return $this->redirect(['controller' => 'Dashboard', 'action' => 'index']);
}
// Set breadcrums
$breadcrumTitles[0] = 'Category Lists';
$breadcrumControllers[0] = 'Dashboard';
$breadcrumActions[0] = 'categoryLists';
$breadcrumTitles[1] = 'Log Entries';
$breadcrumControllers[1] = 'Logentries';
$breadcrumActions[1] = 'index';
$breadcrumTitles[2] = 'Errors';
$breadcrumControllers[2] = 'Logentries';
$breadcrumActions[2] = 'errors';
$this->set((compact('breadcrumTitles', 'breadcrumControllers', 'breadcrumActions')));
$query = $this->Logentries->find('all', ['order' => ['Logentries.id' => 'DESC']])
->where(['logentry_code_id >=' => '50'])
->contain(['LogentryCodes', 'Users']);
$this->set('logentries', $this->paginate($query));
$this->set(compact('user')); // required for contributors menu
$this->render('show-entries');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@
</div>
<p></p>
<div class="table-responsive">
<p>
<ul>
<li><?= $this->Html->link('Show all log entries', ['controller' => 'logentries', 'action' => 'index']) ?></li>
<li><?= $this->Html->link('Show only errors (Type >= 50)', ['controller' => 'logentries', 'action' => 'errors']) ?></li>
</ul>
Available log types:<br>
10 - Notification<br>
20 - Sent email (not implemented yet)<br>
30 - Automated problem fixing (course reminders, etc.)<br>
50 - Non-fatal error<br>
90 - Fatal error<br>
</p>
<table>
<thead>
<tr>
Expand Down

0 comments on commit 639c751

Please sign in to comment.