|
1 | 1 | <?php |
2 | 2 |
|
| 3 | +use VSP\Modules\Logger; |
| 4 | +use VSP\Modules\Logger\File_Handler; |
| 5 | + |
3 | 6 | if ( ! defined( 'ABSPATH' ) ) { |
4 | 7 | exit; |
5 | 8 | } |
@@ -171,12 +174,12 @@ function vsp_get_logger( $subpath = false, $file_name = null, $filesize = false |
171 | 174 | $class = apply_filters( 'vsp_logging_class', '\VSP\Modules\Logger' ); |
172 | 175 | $implements = class_implements( $class ); |
173 | 176 | if ( is_array( $implements ) && in_array( 'VSP\Core\Interfaces\Logger', $implements, true ) ) { |
174 | | - $logger = ( is_object( $class ) ) ? $class : new $class( array( new \VSP\Modules\Logger\File_Handler( $subpath, $file_name, $filesize ) ) ); |
| 177 | + $logger = ( is_object( $class ) ) ? $class : new $class( array( new File_Handler( $subpath, $file_name, $filesize ) ) ); |
175 | 178 | } else { |
176 | 179 | /* translators: 1: class name 2: woocommerce_logging_class 3: WC_Logger_Interface */ |
177 | 180 | $smgs = sprintf( __( 'The class %1$s provided by %2$s filter must implement %3$s.', 'vsp-framework' ), '<code>' . esc_html( is_object( $class ) ? get_class( $class ) : $class ) . '</code>', '<code>vsp_logging_class</code>', '<code>\VSP\Core\Interfaces\Logger</code>' ); |
178 | 181 | vsp_doing_it_wrong( __FUNCTION__, $smgs, '3.0' ); |
179 | | - $logger = new \VSP\Modules\Logger( array( new \VSP\Modules\Logger\File_Handler( $subpath, $file_name, $filesize ) ) ); |
| 182 | + $logger = new Logger( array( new File_Handler( $subpath, $file_name, $filesize ) ) ); |
180 | 183 | } |
181 | 184 | return $logger; |
182 | 185 | } |
@@ -225,10 +228,10 @@ function vsp_log_msg( $messages = '', $type = 'critical', $handler = false, $con |
225 | 228 | $handler = vsp_logger(); |
226 | 229 | } |
227 | 230 |
|
228 | | - if ( $handler instanceof \VSP\Modules\Logger && method_exists( $handler, $type ) ) { |
| 231 | + if ( $handler instanceof Logger && method_exists( $handler, $type ) ) { |
229 | 232 | $handler->$type( $messages, $context ); |
230 | 233 | return true; |
231 | | - } elseif ( vsp_logger() instanceof \VSP\Modules\Logger && method_exists( vsp_logger(), $type ) ) { |
| 234 | + } elseif ( vsp_logger() instanceof Logger && method_exists( vsp_logger(), $type ) ) { |
232 | 235 | $msg = array_merge( array( __( 'Tried To Log A Message But Failed Got unknown Handler', 'vsp-framework' ) ), wp_debug_backtrace_summary( null, 0, false ) ); |
233 | 236 | vsp_log_msg( '----------------------------------------------------------------', 'notice', vsp_logger() ); |
234 | 237 | vsp_log_msg( $msg, 'critical', vsp_logger() ); |
|
0 commit comments