Wednesday, January 28, 2015

Print an array or object in watchdog Drupal

Use below lines of code to print an array or object in watchdog  Drupal.

// Directly use values.
watchdog("log_name", '<pre>' . print_r( $my_object, true) . '</pre>');


// With place holder as per Drupal standard.
watchdog('log_name', '<pre>@place_holder</pre>', 
  array('@place_holder', print_r( $my_array, TRUE))
);


4 comments:

Raj Thakkar said...

Nice Blog! Thank you so much for sharing this one really well defined all peaceful info,I Really like it,Love it- Hire Drupal Developer

kali dasan said...

Thanks Raj :)

raghu konda said...

Great blog created by you. I read your blog, its best and useful information. You have done a great work. Super blogging and keep it up.
php jobs in hyderabad.

kali dasan said...

Thanks Raghu :)

Post a Comment