PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.2.3
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.2.3
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / includes / class-updraft-php-logger.php

class-updraft-php-logger.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.2.3, at includes/class-updraft-php-logger.php

132 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) die('No direct access allowed');
4
5 if (class_exists('Updraft_PHP_Logger')) return;
6 if (!class_exists('Updraft_Abstract_Logger')) require_once('class-updraft-abstract-logger.php');
7
8 /**
9 * Class Updraft_PHP_Logger
10 */
11 class Updraft_PHP_Logger extends Updraft_Abstract_Logger {
12
13 /**
14 * Updraft_PHP_Logger constructor
15 */
16 public function __construct() {
17 }
18
19 /**
20 * Returns logger description
21 *
22 * @return string|void
23 */
24 public function get_description() {
25 return __('Log events into the PHP error log', 'wp-optimize');
26 }
27
28 /**
29 * Emergency message
30 *
31 * @param string $message
32 * @param array $context
33 * @return null|void
34 */
35 public function emergency($message, array $context = array()) {
36 $this->log($message, Updraft_Log_Levels::EMERGENCY, $context);
37 }
38
39 /**
40 * Alert message
41 *
42 * @param string $message
43 * @param array $context
44 * @return null|void
45 */
46 public function alert($message, array $context = array()) {
47 $this->log($message, Updraft_Log_Levels::ALERT, $context);
48 }
49
50 /**
51 * Critical message
52 *
53 * @param string $message
54 * @param array $context
55 * @return null|void
56 */
57 public function critical($message, array $context = array()) {
58 $this->log($message, Updraft_Log_Levels::CRITICAL, $context);
59 }
60
61 /**
62 * Error message
63 *
64 * @param string $message
65 * @param array $context
66 * @return null|void
67 */
68 public function error($message, array $context = array()) {
69 $this->log($message, Updraft_Log_Levels::ERROR, $context);
70 }
71
72 /**
73 * Warning message
74 *
75 * @param string $message
76 * @param array $context
77 * @return null|void
78 */
79 public function warning($message, array $context = array()) {
80 $this->log($message, Updraft_Log_Levels::WARNING, $context);
81 }
82
83 /**
84 * Notice message
85 *
86 * @param string $message
87 * @param array $context
88 * @return null|void
89 */
90 public function notice($message, array $context = array()) {
91 $this->log($message, Updraft_Log_Levels::NOTICE, $context);
92 }
93
94 /**
95 * Info message
96 *
97 * @param string $message
98 * @param array $context
99 * @return null|void
100 */
101 public function info($message, array $context = array()) {
102 $this->log($message, Updraft_Log_Levels::INFO, $context);
103 }
104
105 /**
106 * Debug message
107 *
108 * @param string $message
109 * @param array $context
110 * @return null|void
111 */
112 public function debug($message, array $context = array()) {
113 $this->log($message, Updraft_Log_Levels::DEBUG, $context);
114 }
115
116 /**
117 * Log message with any level
118 *
119 * @param string $message
120 * @param mixed $level
121 * @param array $context
122 * @return null|void
123 */
124 public function log($message, $level, array $context = array()) {
125
126 if (!$this->is_enabled()) return false;
127
128 $message = '['.Updraft_Log_Levels::to_text($level).'] : '.$this->interpolate($message, $context);
129 error_log($message);
130 }
131 }
132