WC_Log_Handler_Email::__construct
Constructor for log handler.
Method of the class: WC_Log_Handler_Email{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_Log_Handler_Email = new WC_Log_Handler_Email(); $WC_Log_Handler_Email->__construct( $recipients, $threshold );
- $recipients(string|array)
- Email(s) to receive log messages.
Default:site admin email - $threshold(string)
- Minimum level that should receive log messages. One of: emergency|alert|critical|error|warning|notice|info|debug.
Default:'alert'
WC_Log_Handler_Email::__construct() WC Log Handler Email:: construct code WC 10.5.0
public function __construct( $recipients = null, $threshold = 'alert' ) {
if ( null === $recipients ) {
$recipients = get_option( 'admin_email' );
}
if ( is_array( $recipients ) ) {
foreach ( $recipients as $recipient ) {
$this->add_email( $recipient );
}
} else {
$this->add_email( $recipients );
}
$this->set_threshold( $threshold );
add_action( 'shutdown', array( $this, 'send_log_email' ) );
}