Blog

Tutorial: Create a logger that logs wp_mail() usage

[comment]

todo:

– screenshot of the log in action

[/comment]

As a developer you can extend Simple History in many ways.

In this tutorial you will learn how to create a simple Logger that will log all usage of the WordPress wp_mail-function. When you have created the logger you will be able to see when WordPress sends out emails, and you will also see the subject and content of each email. Pretty cool, and a great tool for debugging when and how emails are sent!

Simple History + RSS = A simple way to get site events delivered to your computer or phone

Alt text
Screenshot that shows a RSS feed from Simple History in the web based Feedbin RSS reader

RSS is a XML-based file format used to publish frequently updated information. Wikipedia explains the benefits:

RSS feeds benefit users who want to receive timely updates from favorite websites or to aggregate data from many sites.

Subscribing to a website RSS removes the need for the user to manually check the website for new content. Instead, their browser constantly monitors the site and informs the user of any updates. The browser can also be commanded to automatically download the new data for the user.

Simple History has built in support for a RSS-feed. By using this RSS-feed you can get updates from your website directly to your phone or computer. What users have logged in, what plugins have been updated, what posts have been created and what posts have been updated?

With the RSS feed all this info can be delivered to you without the need to login to your website. Great, isn’t it?

Here’s how it works:

2.1.2: the fastest update so far

Well, it took some time to get this release out, but it was worth it: Simple History is now faster than ever before.

Was it not fast before, you may ask. And yes, it was. Most of the time anyway: to minimize the risk of the database growing to large Simple History by default removes all events that are older than 60 days. This behavior is however something that you as a user can change using filters.

If you wanted, you could expand this from 60 days to for example 120 days. Or disable it completely, making Simple History store all site events forever. And forever in combination with lots of users and lots of updated equals a very large log after some months. And that’s when the plugin got a little slow.

Until this version that is. With this release Simple History automagically checks how many events there are the last week or month, and if the number is large it applies a search filter during load, so it only loads for example the events from last week. Or last two weeks. It’s pretty smart so it adapts to the number of events you have. Large amount of events = only load the last week. Small amount of events = load the last month, or even all events no matter the time.

Screenshot of Simple History with a default date filter applied

More nice things in this release

This release also features some other nice things:

Export your event log with version 2.1

Version 2.1 of Simple History is now out.

The biggest news in this release is the addition of an Export feature. Now you don’t have to feel that your data is trapped sometwhere deep inside a datbase – just go Settings » Simple History and select the Export-tab. To begin with there is options to export your events in JSON or CSV format.

View plugin install source and file name in this new update

In the new version of Simple History that was released today you will be able to see where a plugin install or update came from, and what the file name of the uploaded file was. Great for admins that want to have control over their plugin installs and updates!

Screenshot of this feature in action: