Monolog_Logger

Class Monolog_Logger


Source

File: src/Tribe/Log/Monolog_Logger.php

class Monolog_Logger extends Logger {
	/**
	 * @since 4.9.16
	 */
	const DEFAULT_CHANNEL = 'default';

	/**
	 * Resets the global channel to the default one.
	 *
	 * @since 4.9.16
	 *
	 * @return bool Whether the channel reset
	 */
	public function reset_global_channel() {
		return $this->set_global_channel( static::DEFAULT_CHANNEL );
	}

	/**
	 * Clones this logger and replaces it in the `tribe` container.
	 *
	 * @since 4.9.16
	 *
	 * @param string $channel The new logger name, also referred to as "channel" (hence the method name).
	 *
	 * @return bool Whether the channel change was successful or not.
	 */
	public function set_global_channel( $channel ) {
		$new = $this->withName( $channel );
		tribe_register( Logger::class, $new );
		tribe_register( 'monolog', $new );

		return $channel === tribe( 'monolog' )->getName();
	}
}

Top ↑

Changelog

Changelog
Version Description
4.9.16 Introduced.

Top ↑

Methods