PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 2.8.23.5
Pods – Custom Content Types and Fields v2.8.23.5
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / tribe-common / src / Tribe / Log / Monolog_Logger.php
pods / tribe-common / src / Tribe / Log Last commit date
Action_Logger.php 1 week ago Admin.php 1 week ago Canonical_Formatter.php 1 week ago File_Logger.php 1 week ago Logger.php 1 week ago Monolog_Logger.php 1 week ago Null_Logger.php 1 week ago Service_Provider.php 1 week ago
Monolog_Logger.php
54 lines
1 <?php
2 /**
3 * An extension of the base Monolog logger to add our need to replace the instance, and global, loggers.
4 *
5 * @since 4.9.16
6 *
7 * @package Tribe\Log
8 */
9
10 namespace Tribe\Log;
11
12 use Monolog\Logger;
13
14 /**
15 * Class Monolog_Logger
16 *
17 * @since 4.9.16
18 *
19 * @package Tribe\Log
20 */
21 class Monolog_Logger extends Logger {
22 /**
23 * @since 4.9.16
24 */
25 const DEFAULT_CHANNEL = 'default';
26
27 /**
28 * Resets the global channel to the default one.
29 *
30 * @since 4.9.16
31 *
32 * @return bool Whether the channel reset
33 */
34 public function reset_global_channel() {
35 return $this->set_global_channel( static::DEFAULT_CHANNEL );
36 }
37
38 /**
39 * Clones this logger and replaces it in the `tribe` container.
40 *
41 * @since 4.9.16
42 *
43 * @param string $channel The new logger name, also referred to as "channel" (hence the method name).
44 *
45 * @return bool Whether the channel change was successful or not.
46 */
47 public function set_global_channel( $channel ) {
48 $new = $this->withName( $channel );
49 tribe_register( Logger::class, $new );
50 tribe_register( 'monolog', $new );
51
52 return $channel === tribe( 'monolog' )->getName();
53 }
54 }