WC_Logger::get_handlers()
Get an array of log handler instances.
Метод класса: WC_Logger{}
Хуки из метода
Возвращает
WC_Log_Handler_Interface[]
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_handlers();
Код WC_Logger::get_handlers() WC Logger::get handlers WC 9.7.1
protected function get_handlers() { if ( ! is_null( $this->handlers ) ) { $handlers = $this->handlers; } else { $default_handler = LoggingUtil::get_default_handler(); $handler_instance = new $default_handler(); /** * Filter the list of log handler class instances that will run whenever a log entry is added. * * @param WC_Log_Handler_Interface[] * * @since 3.0.0 */ $handlers = apply_filters( 'woocommerce_register_log_handlers', array( $handler_instance ) ); } $registered_handlers = array(); if ( ! empty( $handlers ) && is_array( $handlers ) ) { foreach ( $handlers as $handler ) { if ( $handler instanceof WC_Log_Handler_Interface ) { $registered_handlers[] = $handler; } else { wc_doing_it_wrong( __METHOD__, sprintf( /* translators: 1: class name 2: WC_Log_Handler_Interface */ __( 'The provided handler %1$s does not implement %2$s.', 'woocommerce' ), '<code>' . esc_html( is_object( $handler ) ? get_class( $handler ) : $handler ) . '</code>', '<code>WC_Log_Handler_Interface</code>' ), '3.0' ); } } } return $registered_handlers; }