Fires after an email log entry has been written to the database. Use this to forward log data to an external monitoring service.
do_action( 'groundhogg/email_logger/after_create_log', $log_item, $logger );
You will receive the Email_Log_Item object as the first argument and the Email_Logger instance as the second.
Example
add_action( 'groundhogg/email_logger/after_create_log', 'my_extension_forward_log', 10, 2 );
/**
* Push the email log entry to an external monitoring service.
*
* @param \Groundhogg\Email_Log_Item $log_item
* @param \Groundhogg\Email_Logger $logger
*
* @return void
*/
function my_extension_forward_log( $log_item, $logger ) {
wp_remote_post( MY_EXTENSION_MONITORING_URL, [
'body' => [
'log_id' => $log_item->get_id(),
'subject' => $log_item->get_meta( 'subject' ),
'status' => $log_item->get_meta( 'status' ),
],
] );
}
Was this helpful?
Let us know if this document answered your question. Thatβs the only way we can improve.
