WC_Log_Handler_DB::get_log_source()
Get appropriate source based on file name.
Description Description
Try to provide an appropriate source in case none is provided.
Return Return
(string) Text to use as log source. "" (empty string) if none is found.
Source Source
File: includes/log-handlers/class-wc-log-handler-db.php
protected static function get_log_source() { static $ignore_files = array( 'class-wc-log-handler-db', 'class-wc-logger' ); /** * PHP < 5.3.6 correct behavior * * @see http://php.net/manual/en/function.debug-backtrace.php#refsect1-function.debug-backtrace-parameters */ if ( Constants::is_defined( 'DEBUG_BACKTRACE_IGNORE_ARGS' ) ) { $debug_backtrace_arg = DEBUG_BACKTRACE_IGNORE_ARGS; // phpcs:ignore PHPCompatibility.Constants.NewConstants.debug_backtrace_ignore_argsFound } else { $debug_backtrace_arg = false; } $trace = debug_backtrace( $debug_backtrace_arg ); // @codingStandardsIgnoreLine. foreach ( $trace as $t ) { if ( isset( $t['file'] ) ) { $filename = pathinfo( $t['file'], PATHINFO_FILENAME ); if ( ! in_array( $filename, $ignore_files, true ) ) { return $filename; } } } return ''; }