WC_QuickPay_Log

WC_QuickPay_Log class.

Defined (1)

The class is defined in the following location(s).

/classes/woocommerce-quickpay-log.php  
  1. class WC_QuickPay_Log { 
  2.  
  3. /** The domain handler used to name the log */ 
  4. private $_domain = 'woocommerce-quickpay'; 
  5.  
  6.  
  7. /** The WC_Logger instance */ 
  8. private $_logger; 
  9.  
  10.  
  11. /** 
  12. * __construct. 
  13. * @access public  
  14. * @return void 
  15. */  
  16. public function __construct()  
  17. $this->_logger = new WC_Logger(); 
  18.  
  19.  
  20. /** 
  21. * add function. 
  22. * Uses the build in logging method in WooCommerce. 
  23. * Logs are available inside the System status tab 
  24. * @access public  
  25. * @param string|array|object 
  26. * @return void 
  27. */  
  28. public function add( $param )  
  29. if( is_array( $param ) ) { 
  30. $param = print_r( $param, TRUE );  
  31.  
  32. $this->_logger->add( $this->_domain, $param ); 
  33.  
  34.  
  35. /** 
  36. * clear function. 
  37. * Clears the entire log file 
  38. * @access public  
  39. * @return void 
  40. */  
  41. public function clear()  
  42. return $this->_logger->clear( $this->_domain ); 
  43.  
  44.  
  45. /** 
  46. * separator function. 
  47. * Inserts a separation line for better overview in the logs. 
  48. * @access public  
  49. * @return void 
  50. */  
  51. public function separator()  
  52. $this->add( '--------------------' );  
  53.  
  54.  
  55. /** 
  56. * get_domain function. 
  57. * Returns the log text domain 
  58. * @access public  
  59. * @return string 
  60. */  
  61. public function get_domain()  
  62. return $this->_domain; 
  63.  
  64. /** 
  65. * Returns a link to the log files in the WP backend. 
  66. */ 
  67. public function get_admin_link() { 
  68. $log_path = wc_get_log_file_path($this->_domain); 
  69. $log_path_parts = explode('/', $log_path); 
  70. return add_query_arg(array( 
  71. 'page' => 'wc-status',  
  72. 'tab' => 'logs',  
  73. 'log_file' => end($log_path_parts) 
  74. ), admin_url('admin.php'));