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))
);


3 comments:

Unknown 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

Unknown said...

Thanks Raj :)

Unknown said...

Thanks Raghu :)

Post a Comment