Here is my handy solution to print array/object in watchdog item
in the style...

Contribution Date
Technology
Contribution Project
Contribution Details

Here is my handy solution to print array/object in watchdog item
in the style of devel debug functions (dsm, dpm, dprint_r, etc...)

function MYMODULE_preprocess(&$vars, $hook) { global $user; if(in_array('administrator', $user->roles) && $hook == 'page' && in_array('page__admin__reports__event__%', $vars['theme_hook_suggestions'])) { $message = $vars['page']['content']['system_main']['dblog_table']['#rows'][5][1]; $message_array = json_decode(htmlspecialchars_decode ($message, ENT_QUOTES), true); if(!empty($message_array) && (is_array($message_array) || is_object($message_array)) && module_exists('devel')) { dsm($message_array); } } }

How to use it ?

$var['debug_title'] = 'debugging user in module xyz at line No 1'; $var['data'] = user_load(1); //Log the Array / Object directly into the watchdog watchdog('devel debug','@message', array('@message' => json_encode($var)));

Now go to admin/reports/dblog and click the message of "devel debug" item

Image removed.

Contribution Author
Files count
0
Patches count
0