/EmailLogger

Email engine for CakeLog, CakePHP 2.x

Primary LanguagePHP

EmailLogger plugin

Email engine for CakeLog, CakePHP >= 2.4.x Sends out emails for log entries.
Optional configuration for log levels to send emails, by default to all core log levels.

Background

This plugin was developed when playing with a shared @phpfog CakePHP installation.
No shell and/or file access there. This plugin is just a quick and dirty way check
your app without turning debug on, or check errors that only occur with debug off.

Requirements

  • PHP 5.3
  • CakePHP 2.4.x (CakePHP pre-2.4 checkout commit @eef768d7273dc9ffb50f6cc371e79d5de9e5e20c)

Installation

[Manual]

  1. Download this: http://github.com/ceeram/EmailLogger/zipball/master
  2. Unzip that download.
  3. Copy the resulting folder to app/Plugin
  4. Rename the folder you just copied to EmailLogger

[GIT Submodule]

In your app directory type:

git submodule add git://github.com/ceeram/EmailLogger.git Plugin/EmailLogger
git submodule init
git submodule update

[GIT Clone]

In your plugin directory type

git clone git://github.com/ceeram/EmailLogger.git EmailLogger

Usage

In app/Config/bootstrap.php add: CakePlugin::load(‘EmailLogger’, array(‘bootstrap’ => true));
Add $email_logger configuration in app/Config/email.php or create EmailLogger/Config/config.php

Configuration(optional):

EmailLogger/Config/config.php
Define which levels and email configuration to use for EmailLogger.
Set ‘duplicates’ to false/true to avoid receiving duplicate emails. (defaults to true)
Without this file, EmailLogger will send out emails for all log entries and all core log levels.

Note: Don’t setup your email configuration for EmailLogger with ‘log’ => true
or any log level which will be handled by EmailLogger

Important

It’s not recommended to use this in production.
http://ad7six.com/2007/04/19/Don-t-mail-me-my-site-errors.html

Hint:
Set ‘levels’ => array(‘logger’) and it wont ever send out emails for core errors,
and add CakeLog::write(‘logger’, ‘Log this’); or $this→log(‘Log this’, ‘logger’);
to the code you want to debug.

License

Copyright © 2012 Ceeram

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.