GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
class-gv-logger.php
Go to the documentation of this file.
1 <?php
2 namespace GV;
3 
4 /** If this file is called directly, abort. */
5 if ( ! defined( 'GRAVITYVIEW_DIR' ) ) {
6  die();
7 }
8 
9 /**
10  * Describes log levels.
11  */
12 class LogLevel {
13  const EMERGENCY = 'emergency';
14  const ALERT = 'alert';
15  const CRITICAL = 'critical';
16  const ERROR = 'error';
17  const WARNING = 'warning';
18  const NOTICE = 'notice';
19  const INFO = 'info';
20  const DEBUG = 'debug';
21 }
22 
23 /**
24  * The \GV\Logger abstract class.
25  *
26  * @TODO: (Foundation) Deprecate in future versions.
27  */
28 abstract class Logger /** @todo extends Psr\Log\AbstractLogger */ {
29  /**
30  * System is unusable.
31  *
32  * @param string $message
33  * @param array $context
34  *
35  * @return void
36  */
37  public function emergency($message, array $context = array())
38  {
39  $this->log(LogLevel::EMERGENCY, $message, $context);
40  }
41 
42  /**
43  * Action must be taken immediately.
44  *
45  * Example: Entire website down, database unavailable, etc. This should
46  * trigger the SMS alerts and wake you up.
47  *
48  * @param string $message
49  * @param array $context
50  *
51  * @return void
52  */
53  public function alert($message, array $context = array())
54  {
55  $this->log(LogLevel::ALERT, $message, $context);
56  }
57 
58  /**
59  * Critical conditions.
60  *
61  * Example: Application component unavailable, unexpected exception.
62  *
63  * @param string $message
64  * @param array $context
65  *
66  * @return void
67  */
68  public function critical($message, array $context = array())
69  {
70  $this->log(LogLevel::CRITICAL, $message, $context);
71  }
72 
73  /**
74  * Runtime errors that do not require immediate action but should typically
75  * be logged and monitored.
76  *
77  * @param string $message
78  * @param array $context
79  *
80  * @return void
81  */
82  public function error($message, array $context = array())
83  {
84  $this->log(LogLevel::ERROR, $message, $context);
85  }
86 
87  /**
88  * Exceptional occurrences that are not errors.
89  *
90  * Example: Use of deprecated APIs, poor use of an API, undesirable things
91  * that are not necessarily wrong.
92  *
93  * @param string $message
94  * @param array $context
95  *
96  * @return void
97  */
98  public function warning($message, array $context = array())
99  {
100  $this->log(LogLevel::WARNING, $message, $context);
101  }
102 
103  /**
104  * Normal but significant events.
105  *
106  * @param string $message
107  * @param array $context
108  *
109  * @return void
110  */
111  public function notice($message, array $context = array())
112  {
113  $this->log(LogLevel::NOTICE, $message, $context);
114  }
115 
116  /**
117  * Interesting events.
118  *
119  * Example: User logs in, SQL logs.
120  *
121  * @param string $message
122  * @param array $context
123  *
124  * @return void
125  */
126  public function info($message, array $context = array())
127  {
128  $this->log(LogLevel::INFO, $message, $context);
129  }
130 
131  /**
132  * Detailed debug information.
133  *
134  * @param string $message
135  * @param array $context
136  *
137  * @return void
138  */
139  public function debug($message, array $context = array())
140  {
141  $this->log(LogLevel::DEBUG, $message, $context);
142  }
143 
144  /**
145  * Bake the context into { } placeholders in the message.
146  * @param string $message
147  * @param array $context
148  *
149  * @return string The baked message;
150  */
151  protected function interpolate( $message, $context ) {
152  foreach ( $context as $key => $val ) {
153  if ( strpos( $message, "{{$key}}" ) !== false ) {
154  $message = str_replace( "{{$key}}", (string) $val, $message );
155  }
156  }
157 
158  return $message;
159  }
160 }
161 
162 /** Load implementations. */
163 require gravityview()->plugin->dir( 'future/includes/class-gv-logger-wp-action.php' );
emergency($message, array $context=array())
System is unusable.
debug($message, array $context=array())
Detailed debug information.
critical($message, array $context=array())
Critical conditions.
interpolate( $message, $context)
Bake the context into { } placeholders in the message.
error($message, array $context=array())
Runtime errors that do not require immediate action but should typically be logged and monitored...
alert($message, array $context=array())
Action must be taken immediately.
notice($message, array $context=array())
Normal but significant events.
info($message, array $context=array())
Interesting events.
gravityview()
The main GravityView wrapper function.
If this file is called directly, abort.
warning($message, array $context=array())
Exceptional occurrences that are not errors.
The abstract class.