dblog.views.inc 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <?php
  2. /**
  3. * @file
  4. * Provide views data for dblog.module.
  5. */
  6. /**
  7. * Implements hook_views_data().
  8. */
  9. function dblog_views_data() {
  10. $data = [];
  11. $data['watchdog']['table']['group'] = t('Watchdog');
  12. $data['watchdog']['table']['wizard_id'] = 'watchdog';
  13. $data['watchdog']['table']['base'] = [
  14. 'field' => 'wid',
  15. 'title' => t('Log entries'),
  16. 'help' => t('Contains a list of log entries.'),
  17. ];
  18. $data['watchdog']['wid'] = [
  19. 'title' => t('WID'),
  20. 'help' => t('Unique watchdog event ID.'),
  21. 'field' => [
  22. 'id' => 'standard',
  23. ],
  24. 'filter' => [
  25. 'id' => 'numeric',
  26. ],
  27. 'argument' => [
  28. 'id' => 'numeric',
  29. ],
  30. 'sort' => [
  31. 'id' => 'standard',
  32. ],
  33. ];
  34. $data['watchdog']['uid'] = [
  35. 'title' => t('UID'),
  36. 'help' => t('The user ID of the user on which the log entry was written.'),
  37. 'field' => [
  38. 'id' => 'standard',
  39. ],
  40. 'filter' => [
  41. 'id' => 'numeric',
  42. ],
  43. 'argument' => [
  44. 'id' => 'numeric',
  45. ],
  46. 'relationship' => [
  47. 'title' => t('User'),
  48. 'help' => t('The user on which the log entry as written.'),
  49. 'base' => 'users_field_data',
  50. 'base field' => 'uid',
  51. 'id' => 'standard',
  52. ],
  53. ];
  54. $data['watchdog']['type'] = [
  55. 'title' => t('Type'),
  56. 'help' => t('The type of the log entry, for example "user" or "page not found".'),
  57. 'field' => [
  58. 'id' => 'standard',
  59. ],
  60. 'argument' => [
  61. 'id' => 'string',
  62. ],
  63. 'filter' => [
  64. 'id' => 'dblog_types',
  65. ],
  66. 'sort' => [
  67. 'id' => 'standard',
  68. ],
  69. ];
  70. $data['watchdog']['message'] = [
  71. 'title' => t('Message'),
  72. 'help' => t('The actual message of the log entry.'),
  73. 'field' => [
  74. 'id' => 'dblog_message',
  75. ],
  76. 'argument' => [
  77. 'id' => 'string',
  78. ],
  79. 'filter' => [
  80. 'id' => 'string',
  81. ],
  82. 'sort' => [
  83. 'id' => 'standard',
  84. ],
  85. ];
  86. $data['watchdog']['variables'] = [
  87. 'title' => t('Variables'),
  88. 'help' => t('The variables of the log entry in a serialized format.'),
  89. 'field' => [
  90. 'id' => 'serialized',
  91. 'click sortable' => FALSE,
  92. ],
  93. 'argument' => [
  94. 'id' => 'string',
  95. ],
  96. 'filter' => [
  97. 'id' => 'string',
  98. ],
  99. 'sort' => [
  100. 'id' => 'standard',
  101. ],
  102. ];
  103. $data['watchdog']['severity'] = [
  104. 'title' => t('Severity level'),
  105. 'help' => t('The severity level of the event; ranges from 0 (Emergency) to 7 (Debug).'),
  106. 'field' => [
  107. 'id' => 'machine_name',
  108. 'options callback' => 'Drupal\dblog\Controller\DbLogController::getLogLevelClassMap',
  109. ],
  110. 'filter' => [
  111. 'id' => 'in_operator',
  112. 'options callback' => 'Drupal\Core\Logger\RfcLogLevel::getLevels',
  113. ],
  114. 'sort' => [
  115. 'id' => 'standard',
  116. ],
  117. ];
  118. $data['watchdog']['link'] = [
  119. 'title' => t('Operations'),
  120. 'help' => t('Operation links for the event.'),
  121. 'field' => [
  122. 'id' => 'dblog_operations',
  123. ],
  124. 'argument' => [
  125. 'id' => 'string',
  126. ],
  127. 'filter' => [
  128. 'id' => 'string',
  129. ],
  130. 'sort' => [
  131. 'id' => 'standard',
  132. ],
  133. ];
  134. $data['watchdog']['location'] = [
  135. 'title' => t('Location'),
  136. 'help' => t('URL of the origin of the event.'),
  137. 'field' => [
  138. 'id' => 'standard',
  139. ],
  140. 'argument' => [
  141. 'id' => 'string',
  142. ],
  143. 'filter' => [
  144. 'id' => 'string',
  145. ],
  146. 'sort' => [
  147. 'id' => 'standard',
  148. ],
  149. ];
  150. $data['watchdog']['referer'] = [
  151. 'title' => t('Referer'),
  152. 'help' => t('URL of the previous page.'),
  153. 'field' => [
  154. 'id' => 'standard',
  155. ],
  156. 'argument' => [
  157. 'id' => 'string',
  158. ],
  159. 'filter' => [
  160. 'id' => 'string',
  161. ],
  162. 'sort' => [
  163. 'id' => 'standard',
  164. ],
  165. ];
  166. $data['watchdog']['hostname'] = [
  167. 'title' => t('Hostname'),
  168. 'help' => t('Hostname of the user who triggered the event.'),
  169. 'field' => [
  170. 'id' => 'standard',
  171. ],
  172. 'argument' => [
  173. 'id' => 'string',
  174. ],
  175. 'filter' => [
  176. 'id' => 'string',
  177. ],
  178. 'sort' => [
  179. 'id' => 'standard',
  180. ],
  181. ];
  182. $data['watchdog']['timestamp'] = [
  183. 'title' => t('Timestamp'),
  184. 'help' => t('Date when the event occurred.'),
  185. 'field' => [
  186. 'id' => 'date',
  187. ],
  188. 'argument' => [
  189. 'id' => 'date',
  190. ],
  191. 'filter' => [
  192. 'id' => 'date',
  193. ],
  194. 'sort' => [
  195. 'id' => 'date',
  196. ],
  197. ];
  198. return $data;
  199. }