If you are or aim to be an advanced WooCommerce developer, this week’s WooCommerce function will help you immensely.
And — spoiler alert — that’s not because of this function’s syntax (which is beyond my own understanding), but due to the world of possibility it opens when it’s called from inside a plugin or code snippet.
Logging in software development means keeping a file log of events for troubleshooting and health tracking purposes. Go to WordPress Dashboard > WooCommerce > Status > Logs and take a look at the dropdown: you’ll see dozens if not hundreds of log entries generated by either WooCommerce itself or some of your active WooCommerce extensions.
You can do that too, with wc_get_logger
. The wc_get_logger
function lets you create your own event log. You might want one for troubleshooting something under development or to give your clients a handy report of what a plugin or code snippet did on any given day.
Not sure why and how you should use wc_get_logger
? Here’s more context, some case studies, and a code example. Enjoy!