ActionScheduler_DBLogger::log()
Add a record to an action log.
Метод класса: ActionScheduler_DBLogger{}
Хуков нет.
Возвращает
int
. The log entry ID.
Использование
$ActionScheduler_DBLogger = new ActionScheduler_DBLogger(); $ActionScheduler_DBLogger->log( $action_id, $message, $date );
- $action_id(int) (обязательный)
- Action ID.
- $message(строка) (обязательный)
- Message to be saved in the log entry.
- $date(DateTime)
- Timestamp of the log entry.
По умолчанию: null
Код ActionScheduler_DBLogger::log() ActionScheduler DBLogger::log WC 9.3.3
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; }