diff --git a/api/api.php b/api/api.php index 2d752a1783a..9a3a02173bf 100644 --- a/api/api.php +++ b/api/api.php @@ -35,3 +35,4 @@ require( 'options/rest-api.php' ); require( 'tools/delete-all-products.php'); require( 'tools/disable-wc-email.php' ); require( 'tools/trigger-update-callbacks.php' ); +require( 'tracks/tracks-debug-log.php' ); diff --git a/api/tracks/tracks-debug-log.php b/api/tracks/tracks-debug-log.php new file mode 100644 index 00000000000..7971664cf38 --- /dev/null +++ b/api/tracks/tracks-debug-log.php @@ -0,0 +1,53 @@ +logger = $logger; + $this->logger = $logger; + } + + /** + * Log the event. + * + * @param array $properties Event properties. + * @param string $event_name Event name. + */ + public function log_event( $properties, $event_name ) { + $this->logger->debug( + $event_name, + array( 'source' => $this->source ) + ); + foreach ( $properties as $key => $property ) { + $this->logger->debug( + " - {$key}: {$property}", + array( 'source' => $this->source ) + ); + } + + return $properties; + } +} + +new TracksDebugLog(); \ No newline at end of file