<?php

namespace Endurance\WP\Module\Data;

/**
 * Subscribes to the Event Manager and writes event data to a log file
 */
class Logger implements SubscriberInterface {

	/**
	 * Method for handling receiving event data
	 *
	 * @param Event $event Event object representing data about the event that occurred
	 */
	public function notify( Event $event ) {
		$log = wp_json_encode( $event, JSON_UNESCAPED_SLASHES ) . "\n";
		file_put_contents( dirname( dirname( __FILE__ ) ) . '/debug.log', $log, FILE_APPEND );
	}
}
