WC_Log_Handler_File::format_entry()
Builds a log entry text from timestamp, level and message.
Метод класса: WC_Log_Handler_File{}
Хуки из метода
Возвращает
Строку
. Formatted log entry.
Использование
$result = WC_Log_Handler_File::format_entry( $timestamp, $level, $message, $context );
- $timestamp(int) (обязательный)
- Log timestamp.
- $level(строка) (обязательный)
- emergency|alert|critical|error|warning|notice|info|debug.
- $message(строка) (обязательный)
- Log message.
- $context(массив) (обязательный)
- Additional information for log handlers.
Код WC_Log_Handler_File::format_entry() WC Log Handler File::format entry WC 9.8.1
protected static function format_entry( $timestamp, $level, $message, $context ) { if ( isset( $context['_legacy'] ) && true === $context['_legacy'] ) { if ( isset( $context['source'] ) && $context['source'] ) { $handle = $context['source']; } else { $handle = 'log'; } $message = apply_filters( 'woocommerce_logger_add_message', $message, $handle ); $time = date_i18n( 'm-d-Y @ H:i:s' ); $entry = "{$time} - {$message}"; } else { $entry = parent::format_entry( $timestamp, $level, $message, $context ); } return $entry; }