GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
class-gv-logger-wp-action.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  * The \GV\WP_Action_Logger implementation.
11  *
12  * @TODO: (Foundation) Deprecate in future versions.
13  *
14  * Uses the old logging stuff for now.
15  */
16 class WP_Action_Logger extends Logger {
17 
18  /**
19  * Logs with an arbitrary level using `do_action` and our
20  * old action handlers.
21  *
22  * $context['data'] will be passed to the action.
23  *
24  * @param mixed $level The log level.
25  * @param string $message The message to log.
26  * @param array $context The context.
27  *
28  * @return void
29  */
30  protected function log( $level, $message, $context ) {
31  $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 3 );
32  $location = $this->interpolate( "{class}{type}{function}", $backtrace[2] );
33  $message = $this->interpolate( "[$level, $location] $message", $context );
34 
35  switch ( $level ):
36  case LogLevel::EMERGENCY:
37  case LogLevel::ALERT:
38  case LogLevel::CRITICAL:
39  case LogLevel::ERROR:
40  $action = 'error';
41  break;
42  case LogLevel::WARNING:
43  case LogLevel::NOTICE:
44  case LogLevel::INFO:
45  case LogLevel::DEBUG:
46  $action = 'debug';
47  break;
48  endswitch;
49 
50  if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) ) {
51  /** Let's make this testable! */
52  do_action(
53  sprintf( 'gravityview_log_%s_test', $action ),
54  $this->interpolate( $message, $context ),
55  empty( $context['data'] ) ? array() : $context['data']
56  );
57  }
58 
59  do_action(
60  sprintf( 'gravityview_log_%s', $action ),
61  $this->interpolate( $message, $context ),
62  empty( $context['data'] ) ? array() : $context['data']
63  );
64  }
65 }
If this file is called directly, abort.
log( $level, $message, $context)
Logs with an arbitrary level using do_action and our old action handlers.
The abstract class.