# activitypub/0.9.0/includes/class-debug.php

ActivityPub, version 0.9.0. 31 lines.

- Page: https://pluginprobe.com/plugins/activitypub/0.9.0/code/includes/class-debug.php
- Raw: https://pluginprobe.com/plugins/activitypub/0.9.0/raw/includes/class-debug.php
- Modified: 2019-09-29T18:11:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/activitypub/0.9.0/code/includes/class-debug.php#L10-L20`.

```php
<?php
namespace Activitypub;

/**
 * ActivityPub Debug Class
 *
 * @author Matthias Pfefferle
 */
class Debug {
	/**
	 * Initialize the class, registering WordPress hooks
	 */
	public static function init() {
		if ( WP_DEBUG_LOG ) {
			\add_action( 'activitypub_safe_remote_post_response', array( '\Activitypub\Debug', 'log_remote_post_responses' ), 10, 4 );
		}
	}

	public static function log_remote_post_responses( $response, $url, $body, $user_id ) {
		\error_log( "Request to: {$url} with response: " . \print_r( $response, true ) );
	}

	public static function write_log( $log ) {
		if ( is_array( $log ) || is_object( $log ) ) {
			\error_log( \print_r( $log, true ) );
		} else {
			\error_log( $log );
		}
	}
}

```
