Giter Club home page Giter Club logo

hook-logger-plugin's Introduction

hook-logger-plugin

Easily debug WordPress action / filter hooks, finding where actions are called from and understanding the flow of execution.

This plugin does nothing on its own and requires the user to add additional code elsewhere.

the easist way to generate output is...

$logger = new Hook_Logger_Plugin();
$logger->log_to_file = true;

This will create a new .log file for each and every request. By default logging to file does not happen.

Additional Config

The most common usage is supplying include or exclude strings / regex.

When a string is passed it will match against the start of the action. eg, option will match option_test but not test_option. When a regex is passed it must start with /. eg /mail/ will match wp_mail and sanitize_email

$logger = new Hook_Logger_Plugin();
$logger->include = ['mail'];

or

$logger = new Hook_Logger_Plugin();
$logger->exclude[] = '/plugin/';

Note: by default there are a number of helpful exclusions pre-loaded.

Sample log file

Date: Sun, 19 Dec 2021 23:32:11 +0000
URL: /wp-admin/edit.php
Method: URL: GET
POST:
array (
)

2021-12-19 23:32:11.446 plugin_loaded /var/www/wp-settings.php:418
2021-12-19 23:32:11.447 plugin_loaded /var/www/wp-settings.php:418
2021-12-19 23:32:11.448 pre_transient_jetpack_autoloader_plugin_paths /var/www/wp-includes/option.php:831
2021-12-19 23:32:11.448 transient_jetpack_autoloader_plugin_paths /var/www/wp-includes/option.php:871
2021-12-19 23:32:11.448 upload_dir /var/www/wp-includes/functions.php:2323
2021-12-19 23:32:11.449 woocommerce_helper_api_base /var/www/wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper-api.php:33
2021-12-19 23:32:11.449 woocommerce_helper_loaded /var/www/wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:49
2021-12-19 23:32:11.449 template /var/www/wp-includes/theme.php:315
2021-12-19 23:32:11.450 woocommerce_data_stores /var/www/wp-content/plugins/woocommerce/includes/class-wc-data-store.php:82
2021-12-19 23:32:11.450 woocommerce_customer-download_data_store /var/www/wp-content/plugins/woocommerce/includes/class-wc-data-store.php:92
2021-12-19 23:32:11.450 plugin_loaded /var/www/wp-settings.php:418
2021-12-19 23:32:11.450 set_url_scheme /var/www/wp-includes/link-template.php:3803

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.