Skip to content

Commit

Permalink
Add logging for potential causes of high CPU usage
Browse files Browse the repository at this point in the history
  • Loading branch information
EarthlingDavey committed Nov 19, 2024
1 parent 656418b commit b62f305
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions public/app/themes/clarity/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,56 @@
$search = new MOJ\Intranet\Search();
$search->hooks();

/**
* Add logging on potential causes of high CPU usage
*/

// Log on document_serve
add_action('document_serve', function ($file, $post_id, $attach_id) {
error_log('CDPT_Debug: document_serve: ' . $file . ' ' . $post_id . ' ' . $attach_id);
}, 10, 3);

// Log on document_serve_done
add_action('document_serve_done', function ($file, $attach_id ) {
error_log('CDPT_Debug: document_serve_done: ' . $file . ' ' . $attach_id);
}, 10, 2);

// Log on document edit
add_action('document_edit', function () {
error_log('CDPT_Debug: document_edit');
}, 10);

// Log on document saved
add_action('document_saved', function ($doc_id, $attach_id) {
error_log('CDPT_Debug: document_saved: ' . $doc_id . ' ' . $attach_id);
}, 10, 2);

// Log on attachment upload
add_action('add_attachment', function ($attach_id) {
error_log('CDPT_Debug: add_attachment: ' . $attach_id);
}, 10, 1);

// Log on edit post
add_action('edit_post', function ($post_id) {
error_log('CDPT_Debug: edit_post: ' . $post_id);
}, 10, 1);

// Log on post save
add_action('save_post', function ($post_id) {
error_log('CDPT_Debug: save_post: ' . $post_id);
}, 10, 1);

// Log on S3 upload - as3cf_post_upload_attachment
add_action('as3cf_post_upload_attachment', function ($source_id, $item) {
error_log('CDPT_Debug: as3cf_post_upload_attachment: ' . $source_id);
}, 10, 3);

// Log on as3cf_pre_upload_object
add_action('as3cf_pre_upload_object', function ($args) {
error_log('CDPT_Debug: as3cf_pre_upload_object');
}, 10, 1);

// Log on as3cf_post_upload_item
add_action('as3cf_post_upload_item', function ($item) {
error_log('CDPT_Debug: as3cf_post_upload_item');
}, 10, 1);

0 comments on commit b62f305

Please sign in to comment.