WordPress.org

Ready to get started?Download WordPress

Plugin Directory

!This plugin hasn't been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

LogStore

LogStore is a 'meta' plugin that allows other plugins to log data easily.

Usage

To use LogStore in your plugin, add the following line to your plugin's 'plugins_loaded' callback function:

if (class_exists('LogStore')) $this->log = new LogStore('slug', __('Title'));
  • The 'slug' should be a unique identifier for your logger.
  • The 'Title' will be the title used in menu entries, options and page titles.

Once that's done you can then start logging your data from anywhere within your plugin by using the following:

if (!empty($this->log)) $this->log->log(__('My log message'), $my_log_data, 'status', 'tag');
  • 'My log message.' is any arbitrary message to describe your log entry.
  • $my_log_data is the extended data you want to log. This can be either an array or string.
  • 'status' is one of 'none', 'ok', 'warn', 'critical' or 'fatal'.
  • 'tag' can be any kind of singular tag to further classification to your log entries.add

If you use LogStore in your plugin, you should check for it's presence in

  • your 'plugins_loaded' callback
  • your plugin activation callback

You should either make LogStore use optional or notify the user that they need to install LogStore for your plugin to work properly.

Plugin Hooks

In the following hooks, *myname* stands for the name with which you instanciated the LogStore class.

Action Hooks

  • logstore_init-*myname* - runs during the execution of WP's init action hook, passes a single boolean parameter indicating if logging is active or inactive for this logger

Filter Hooks

  • logstore_new_entry-*myname* - runs during the creation of a new entry, passes a single array containing all values for that entry ('time', 'message', 'data', 'status' and 'tag')
  • logstore_entry-*myname* - runs before displaying an entry on screen, passes a single array containting all values for the entry ('time', 'message', 'data', 'status' and 'tag')
  • logstore_format_entry_data-*myname* - runs before displaying the formatted data on screen, passes the formatted data as string

Further Notes

Please note that the 'bulk actions' in the log viewer are currently not working.

Requires: 3.1 or higher
Compatible up to: 3.1.4
Last Updated: 2011-2-27
Downloads: 318

Ratings

4 stars
4 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

0,1,0