Automattic\WooCommerce\Internal\Orders

OrderAttributionController::log()privateWC 1.0

Log a message as a debug log entry.

Method of the class: OrderAttributionController{}

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->log( $message, $method, $level );
$message(string) (required)
The message to log.
$method(string) (required)
The method that is logging the message.
$level(string)
The log level.
Default: WC_Log_Levels::DEBUG

OrderAttributionController::log() code WC 9.4.2

private function log( string $message, string $method, string $level = WC_Log_Levels::DEBUG ) {
	/**
	 * Filter to enable debug mode.
	 *
	 * @since 8.5.0
	 *
	 * @param string $enabled 'yes' to enable debug mode, 'no' to disable.
	 */
	if ( 'yes' !== apply_filters( 'wc_order_attribution_debug_mode_enabled', 'no' ) ) {
		return;
	}

	$this->logger->log(
		$level,
		sprintf( '%s %s', $method, $message ),
		array( 'source' => 'woocommerce-order-attribution' )
	);
}