WordPress at Your Fingertips
function is not described

ActionScheduler_DBLogger::log() public WC 1.0

Add a record to an action log.

{} It's a method of the class: ActionScheduler_DBLogger{}

No Hooks.

Return

Int. The log entry ID.

Usage

$ActionScheduler_DBLogger = new ActionScheduler_DBLogger();
$ActionScheduler_DBLogger->log( $action_id, $message, $date );
$action_id(int) (required)
Action ID.
$message(string) (required)
Message to be saved in the log entry.
$date(DateTime)
Timestamp of the log entry.
Default: null

Code of ActionScheduler_DBLogger::log() WC 6.1.1

public function log( $action_id, $message, DateTime $date = null ) {
	if ( empty( $date ) ) {
		$date = as_get_datetime_object();
	} else {
		$date = clone $date;
	}

	$date_gmt = $date->format( 'Y-m-d H:i:s' );
	ActionScheduler_TimezoneHelper::set_local_timezone( $date );
	$date_local = $date->format( 'Y-m-d H:i:s' );

	/** @var \wpdb $wpdb */ //phpcs:ignore Generic.Commenting.DocComment.MissingShort
	global $wpdb;
	$wpdb->insert(
		$wpdb->actionscheduler_logs,
		array(
			'action_id'      => $action_id,
			'message'        => $message,
			'log_date_gmt'   => $date_gmt,
			'log_date_local' => $date_local,
		),
		array( '%d', '%s', '%s', '%s' )
	);

	return $wpdb->insert_id;
}