How to log our own error messages(for ex: error due to invalid user date entry) which is generated in php program to drupal error log.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
You can use the
watchdog
function :Quoting the manual, the parameters are :
$type
The category to which this message belongs.$message
The message to store in the log.$variables
Array of variables to replace in the message on display or NULL if message is already translated or not possible to translate.$severity
The severity of the message, as per RFC 3164$link
A 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 useWATCHDOG_ERROR
, or maybe even something more "critical", depending on the kind of error.