public DbLogController::eventDetails($event_id)
Displays details about a specific database log message.
Parameters
int $event_id: Unique ID of the database log message.
Return value
array If the ID is located in the Database Logging table, a build array in the format expected by drupal_render();
File
- core/modules/dblog/src/Controller/DbLogController.php, line 238
Class
- DbLogController
- Returns responses for dblog routes.
Namespace
Drupal\dblog\Controller
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | public function eventDetails( $event_id ) { $build = array (); if ( $dblog = $this ->database->query( 'SELECT w.*, u.uid FROM {watchdog} w LEFT JOIN {users} u ON u.uid = w.uid WHERE w.wid = :id' , array ( ':id' => $event_id ))->fetchObject()) { $severity = RfcLogLevel::getLevels(); $message = $this ->formatMessage( $dblog ); $username = array ( '#theme' => 'username' , '#account' => $dblog ->uid ? $this ->userStorage->load( $dblog ->uid) : User::getAnonymousUser(), ); $rows = array ( array ( array ( 'data' => $this ->t( 'Type' ), 'header' => TRUE), $this ->t( $dblog ->type), ), array ( array ( 'data' => $this ->t( 'Date' ), 'header' => TRUE), $this ->dateFormatter->format( $dblog ->timestamp, 'long' ), ), array ( array ( 'data' => $this ->t( 'User' ), 'header' => TRUE), array ( 'data' => $username ), ), array ( array ( 'data' => $this ->t( 'Location' ), 'header' => TRUE), $this ->l( $dblog ->location, $dblog ->location ? Url::fromUri( $dblog ->location) : Url::fromRoute( '<none>' )), ), array ( array ( 'data' => $this ->t( 'Referrer' ), 'header' => TRUE), $this ->l( $dblog ->referer, $dblog ->referer ? Url::fromUri( $dblog ->referer) : Url::fromRoute( '<none>' )), ), array ( array ( 'data' => $this ->t( 'Message' ), 'header' => TRUE), $message , ), array ( array ( 'data' => $this ->t( 'Severity' ), 'header' => TRUE), $severity [ $dblog ->severity], ), array ( array ( 'data' => $this ->t( 'Hostname' ), 'header' => TRUE), $dblog ->hostname, ), array ( array ( 'data' => $this ->t( 'Operations' ), 'header' => TRUE), array ( 'data' => array ( '#markup' => $dblog ->link)), ), ); $build [ 'dblog_table' ] = array ( '#type' => 'table' , '#rows' => $rows , '#attributes' => array ( 'class' => array ( 'dblog-event' )), '#attached' => array ( 'library' => array ( 'dblog/drupal.dblog' ), ), ); } return $build ; } |
Please login to continue.