Want to log error message in Drupal? You can use the
watchdog($type, $message, $variables = array(), $severity =
WATCHDOG_NOTICE, $link = NULL)
Quoting the manual, the parameters are:
$typeThe category to which this message belongs.
$messageThe message to store in the log.
$variablesArray of variables to replace in the message on display or NULL if message is already translated or not possible to translate.
$severityThe severity of the message, as per RFC 3164
$linkA link to associate with the message.
And the error levels can be found on the page of
watchdog_severity_levels. For an error, you’ll most probably use
WATCHDOG_ERROR, or maybe even something more “critical”, depending on the kind of error.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.