From 2c703c8a8488464bbb3aea81fa1821a364a25d4f Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 19 Aug 2009 05:41:58 +0000 Subject: [PATCH] MINOR Added NOTICE level priority to SSLog MINOR Added @deprecated php tag to deprecated functions in the Debug class MINOR Class documentation for SSLog and Debug git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84811 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- dev/Debug.php | 31 ++++++++++++++----------------- dev/SSLog.php | 11 +++++++---- dev/SSLogEmailWriter.php | 2 ++ 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/dev/Debug.php b/dev/Debug.php index 4151bfb75..3a4efefc6 100644 --- a/dev/Debug.php +++ b/dev/Debug.php @@ -2,11 +2,9 @@ /** * Supports debugging and core error handling. * - * Attaches custom methods to the default - * error handling hooks in PHP. Currently, three levels - * of error are supported: + * Attaches custom methods to the default error handling hooks + * in PHP. Currently, two levels of error are supported: * - * - Notice * - Warning * - Error * @@ -16,24 +14,16 @@ * Uncaught exceptions are currently passed to the debug * reporter as standard PHP errors. * - * There are four different types of error handler supported by the - * Debug class: + * Errors handled by this class are passed along to {@link SSLog}. + * For configuration information, see the {@link SSLog} + * class documentation. * - * - Friendly - * - Fatal - * - Logger - * - Emailer - * - * Currently, only Friendly, Fatal, and Emailer handlers are implemented. - * - * @todo port header/footer wrapping code to external reporter class * @todo add support for user defined config: Debug::die_on_notice(true | false) * @todo add appropriate handling for E_NOTICE and E_USER_NOTICE levels * @todo better way of figuring out the error context to display in highlighted source - * @todo implement error logger handler * * @package sapphire - * @subpackage core + * @subpackage dev */ class Debug { @@ -270,7 +260,7 @@ class Debug { self::showError($errno, $errstr, $errfile, $errline, $errcontext, "Error"); } else { - Debug::friendlyError(); + self::friendlyError(); } exit(1); } @@ -461,6 +451,7 @@ class Debug { /** * @param string $server IP-Address or domain + * @deprecated 2.5 See SSLog on setting up error email notification */ static function set_custom_smtp_server($server) { self::$custom_smtp_server = $server; @@ -468,6 +459,7 @@ class Debug { /** * @return string + * @deprecated 2.5 See SSLog on setting up error email notification */ static function get_custom_smtp_server() { return self::$custom_smtp_server; @@ -478,6 +470,8 @@ class Debug { * Can be used like so: * if(Director::isLive()) Debug::send_errors_to("sam@silverstripe.com"); * + * @deprecated 2.5 See SSLog on setting up error email notification + * * @param string $emailAddress The email address to send errors to * @param string $sendWarnings Set to true to send warnings as well as errors (Default: false) */ @@ -488,6 +482,7 @@ class Debug { /** * @return string + * @deprecated 2.5 See SSLog on setting up error email notification */ static function get_send_errors_to() { return self::$send_errors_to; @@ -495,6 +490,7 @@ class Debug { /** * @param string $emailAddress + * @deprecated 2.5 See SSLog on setting up error email notification */ static function send_warnings_to($emailAddress) { self::$send_warnings_to = $emailAddress; @@ -502,6 +498,7 @@ class Debug { /** * @return string + * @deprecated 2.5 See SSLog on setting up error email notification */ static function get_send_warnings_to() { return self::$send_warnings_to; diff --git a/dev/SSLog.php b/dev/SSLog.php index a120bdd19..bc55c9d99 100644 --- a/dev/SSLog.php +++ b/dev/SSLog.php @@ -5,13 +5,15 @@ * sends it to one or more {@link Zend_Log_Writer_Abstract} * subclasses for output. * - * The only priorities currently supported are SSLog::ERR and - * SSLog::WARN - this may change in the future if other types - * are to be supported. + * These priorities are currently supported: + * - SSLog::ERR + * - SSLog::WARN + * - SSLog::NOTICE * * You can add an error writer by calling {@link SSLog::add_writer()} * - * Example usage (called from mysite/_config.php): + * Example usage (called from mysite/_config.php) which adds a writer + * that will write all errors: * * $emailWriter = new SSErrorEmailWriter('my@email.com'); * SSLog::add_writer($emailWriter, SSLog::ERR); @@ -27,6 +29,7 @@ class SSLog { const ERR = Zend_Log::ERR; const WARN = Zend_Log::WARN; + const NOTICE = Zend_Log::NOTICE; /** * Logger class to use. diff --git a/dev/SSLogEmailWriter.php b/dev/SSLogEmailWriter.php index 999f17dea..a99833683 100644 --- a/dev/SSLogEmailWriter.php +++ b/dev/SSLogEmailWriter.php @@ -3,6 +3,8 @@ * Sends an error message to an email whenever an error occurs * in sapphire. * + * @see SSLog for more information on using writers. + * * @package sapphire * @subpackage dev */