Torro_Forms::logger()

Returns the plugin’s logger instance.

Description

See also

Return

(Psr\Log\LoggerInterface) The logger instance.

Source

File: src/torro-forms.php

	public function logger() {
		if ( ! $this->logger ) {

			/**
			 * Filters initializing the plugin's logger instance.
			 *
			 * An implementation of Psr\Log\LoggerInterface may be returned to use
			 * that instead of the regular logger, which simply uses the typical
			 * PHP error handler controlled by WordPress.
			 *
			 * @since 1.0.0
			 *
			 * @param Psr\Log\LoggerInterface|null Logger instance to use, or null to not override (default).
			 */
			$logger = apply_filters( "{$this->prefix}set_logger", null );
			if ( $logger && is_a( $logger, 'Psr\Log\LoggerInterface' ) ) {
				$this->logger = $logger;
			} else {
				$this->logger = $this->instantiate_plugin_class( 'Logger' );
			}
		}

		return $this->logger;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.