Template OmniLogger 1.0
Template OmniLogger brings the event logging functionality of the OmniLog API into your ExpressionEngine templates.
About OmniLog
Stephen Lewis's OmniLog module provides a simple API for adding message logging capabilities to an ExpressionEngine add-on. Using OmniLog, add-on developers can easily log notices, warnings, and errors.
Better yet, OmniLog ensures that important messages don’t go unnoticed by emailing details of the log entry to site administrators (at your discretion, of course).
(You can read about the module and how it works on the OmniLog webpage.)
But what if you want to create entries in OmniLog entries based on events that run in your templates? That's where Template OmniLogger comes in.
Installation
- If you don't already have OmniLog installed, go grab it and drop it into your ExpressioneEngine installation.
- Un-ZIP the Template OmniLogger download and copy the /third_party/template_omnilogger folder into your /system/expressionengine/third_party direcotry.
- There is no Step 3.
Single tag → simple message (without Extended Content)
The only required parameter is the message you want to log:
{exp:template_omnilogger message="Something happened!"}
(If the message is empty, no log entry will be created.)
Tag pair → message with Extended Content
Again, the message parameter is required.
The contents of the tag pair will be recorded as the Extended Content of the log entry.
{exp:template_omnilogger message="Something happened!"}
Extended content goes here!
{/exp:template_omnilogger}
Parameters
The available parameters correspond to the log entry fields in OmniLog.
- source — Appears in the Add-on field of the entry. (defaults to "[Template]")
- message — Fills the Message field in OmniLogger.
- type — Describes the severity of the logged event: notice, warning, or error (defaults to "notice")
- notify_admin — Set to "yes" if you want OmniLog to dispatch an email notification. (default: "no")
- admin_emails — A comma-separated list of admin emails to notify (default: site webmaster email)
- echo — When using the tag pair, set echo to "on" if you want the tag contents to be output to the template. (default: "off")