如何在 Drupal 的自定义日志中添加 array/hash?

How can I add an array/hash in a custom log in Drupal?

我知道 Drupal 7 有一个看门狗方法可以将字符串放入最近的日志中,例如

watchdog('php', 'error message');

如何自定义它并在日志中添加 array/hash?

请尝试以下行:

watchdog('CUSTOM LOG', '<pre>'.print_r($yourArray, true).'</pre>');

并且您可以在最近的日志中过滤 CUSTOM LOG 作为您自己的类型。