WC_Log_Handler_Email::__construct( string|array $recipients = null, string $threshold = 'alert' )

Constructor for log handler.


Description Description


Parameters Parameters

$recipients

(Optional) Email(s) to receive log messages. Defaults to site admin email.

Default value: null

$threshold

(Optional) Minimum level that should receive log messages. Default 'alert'. One of: emergency|alert|critical|error|warning|notice|info|debug.

Default value: 'alert'


Top ↑

Source Source

File: includes/log-handlers/class-wc-log-handler-email.php

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


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.