Logging API for Frog Dashboard

Blog Projects
frog php

Dashboard plugin for Frog CMS now provides simple API for other developers to log their events. Whenever you want to log something to dashboard just trigger a log event. Include your message as parameter.

Observer::notify('log_event', 'Something was done by :username.');

In your message you can include string :username to log the user name.

Priority and Ident

You can also provide priority and ident for the log message. Priority is used to inform about severity of the message. Ident is used to identify sender of the message. Plugin developers should use the ident of their plugin. For example Funky Cache plugin uses funky_cache as ident.

Observer::notify('log_event', 'Something else was done by :username.',
                               DASHBOARD_LOG_NOTICE, 'pluginname');

Priorities are defined in Dashboard code.

define('DASHBOARD_LOG_EMERG',    0); /* system no longer available */
define('DASHBOARD_LOG_ALERT',    1); /* immediate action required */
define('DASHBOARD_LOG_CRIT',     2); /* critical condition */
define('DASHBOARD_LOG_ERR',      3); /* error condition */
define('DASHBOARD_LOG_WARNING',  4); /* warning messages */
define('DASHBOARD_LOG_NOTICE',   5); /* normal, but significant, condition */
define('DASHBOARD_LOG_INFO',     6); /* general informative messages */
define('DASHBOARD_LOG_DEBUG',    7); /* debugging information */

If your code uses constants and Frog is in debug mode and Dashboard plugin is not installed this will cause PHP to display “Use of undefined constant” warnings. If you want to be sure your user will never see these warnings you can use number instead of constant:

Observer::notify('log_event', 'Something else was done by :username.',
                               4, 'pluginname');

You could also define the constants yourself. But make sure they are not already defined (Dashboard installed). Defining constants twice will cause warnings.


Download the latest tarball or checkout from GitHub.

When asking a question include an URL to example page where the problem occurs. Even better is to make a Fiddle which demonstrates the problem. If you have longer code examples please use pastie.org.