windowssite.blogg.se

Drupal logs
Drupal logs









drupal logs

Just to note, that the log entry is added to the database with the placeholders, it is only when the message is output into a UI or similar that the placeholders are rendered with the specified values. The below example is using placeholders that when rendered will be replaced with the value from an array that maps values to placeholders. You can also output arrays and objects in a prettier/ more readable manner too, you just need to concatenate pre tags to your output.

drupal logs

'Email injection exploit attempted in email form subject: '. The below example adds in the contents of a variable and sets the severity to the WATCHDOG_NOTICE constant.

drupal logs

watchdog('my_module', 'my error message')

#Drupal logs code#

$link A link to associate with the message.Īs shown in the code below, the minimum you need is the type and message.

  • WATCHDOG_NOTICE: (default) Normal but significant conditions.
  • WATCHDOG_CRITICAL: Critical conditions.
  • WATCHDOG_ALERT: Alert, action must be taken immediately.
  • WATCHDOG_EMERGENCY: Emergency, system is unusable.
  • $variables Array of variables to replace in the message on display or NULL if message is already translated or not possible to translate. $message The message to store in the log. Can be any string, but the general practice is to use the name of the module that is calling the watchdog function. $type The category to which this message belongs. In Drupal 7, there is a function provided called watchdog, the function takes a number of different parameters.











    Drupal logs