CondeNast / purgely

A WordPress plugin to manage Fastly caching behavior and purging.
24 stars 9 forks source link

Debug mode #23

Open tollmanz opened 8 years ago

tollmanz commented 8 years ago

I receive an excellent suggestion from Fastly's support team to add a "debug" mode that logs, in one way or another, when purge requests have been made. They are reporting that when working with one client, they do not think that the purge requests are being made. Having some logging around these events would be really helpful for troubleshooting such issues.

orenwolf commented 8 years ago

I'll +1 this. For a roughshod way to do this, Fastly had me add:

// adding logging
$datetime = date( "Y/m/d (D) H:i:s", time() );
error_log("Purgely Purge Log : ".$datetime." ".$request_uri."\n", 3, '<file>');

After line 114 of purgely/src/classes/purge-request.php (where is the destination for the log). This seemed to catch purges quite well. Obviously needs to be parameterized and enable-able.

tollmanz commented 8 years ago

@orenwolf Thanks for the code! I think I'd like to do something along those lines. I might add some new actions and attach logging to those actions.