woocommerce_logging_class

Get a shared logger instance.

Description

(WC_Logger) apply_filters( 'woocommerce_logging_class', (string) $wc_logger ); 

Use the woocommerce_logging_class filter to change the logging class. You may provide one of the following: In either case, the class or instance *must* implement WC_Logger_Interface.

Returns (WC_Logger)

Parameters (1)

0. $wc_logger (string) => 'WC_Logger'
The wc logger.

Usage

To run the hook, copy the example below.
  1. $wc_logger = apply_filters( 'woocommerce_logging_class', $wc_logger ); 
  2.  
  3. if ( !empty( $wc_logger ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_logging_class callback 
  2. function filter_woocommerce_logging_class( $wc_logger ) { 
  3. // make filter magic happen here... 
  4. return $wc_logger
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_logging_class', 'filter_woocommerce_logging_class', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_logging_class', 'filter_woocommerce_logging_class', 10, 1 ); 

Defined (1)

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

/includes/wc-core-functions.php  
  1. $class = apply_filters( 'woocommerce_logging_class', 'WC_Logger' );