PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.1
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.1
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / loggers / logger.php

logger.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.1, at src/loggers/logger.php

52 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Loggers;
4
5 use YoastSEO_Vendor\Psr\Log\LoggerInterface;
6 use YoastSEO_Vendor\Psr\Log\LoggerTrait;
7 use YoastSEO_Vendor\Psr\Log\NullLogger;
8
9 /**
10 * Our logger class.
11 */
12 class Logger implements LoggerInterface {
13
14 use LoggerTrait;
15
16 /**
17 * The logger object.
18 *
19 * @var LoggerInterface
20 */
21 protected $wrapped_logger;
22
23 /**
24 * Logger constructor.
25 */
26 public function __construct() {
27 $this->wrapped_logger = new NullLogger();
28
29 /**
30 * Gives the possibility to set override the logger interface.
31 *
32 * @api \YoastSEO_Vendor\Psr\Log\LoggerInterface $logger Instance of NullLogger.
33 *
34 * @return LoggerInterface The logger object.
35 */
36 $this->wrapped_logger = \apply_filters( 'wpseo_logger', $this->wrapped_logger );
37 }
38
39 /**
40 * Logs with an arbitrary level.
41 *
42 * @param mixed $level The log level.
43 * @param string $message The log message.
44 * @param array $context The log context.
45 *
46 * @return void
47 */
48 public function log( $level, $message, array $context = [] ) {
49 $this->wrapped_logger->log( $level, $message, $context );
50 }
51 }
52