Webylon 3.2 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • BuildTask
  • CliDebugView
  • ConvertFrom26Task
  • Debug
  • DebugView
  • DeleteUnusedCustomerFilesTask
  • DevelopmentAdmin
  • FillLinkTrackingTask
  • FillOldLogDataTask
  • FindBadLinksTask
  • ImportTestContentTask
  • MigrationTask
  • MySQLDatabaseConfigurationHelper
  • PhotoGalleryMigrationTask
  • SapphireREPL
  • SS_Backtrace
  • SS_Cli
  • SS_Log
  • SS_LogEmailWriter
  • SS_LogErrorEmailFormatter
  • SS_LogErrorFileFormatter
  • SS_LogFileWriter
  • SS_ZendLog
  • TaskRunner
 1 <?php
 2 require_once 'Zend/Log/Writer/Abstract.php';
 3 
 4 /**
 5  * Sends an error message to an email whenever an
 6  * error occurs in sapphire.
 7  * 
 8  * Note: You need to make sure your web server is able
 9  * to write to the file path that you specify to write
10  * logs to.
11  * 
12  * @uses error_log() built-in PHP function.
13  * @see SS_Log for more information on using writers.
14  * 
15  * @package sapphire
16  * @subpackage dev
17  */
18 class SS_LogFileWriter extends Zend_Log_Writer_Abstract {
19 
20     /**
21      * The path to the file that errors will be stored in.
22      * For example, "/var/logs/silverstripe/errors.log".
23      * 
24      * @var string
25      */
26     protected $path;
27     
28     /**
29      * Message type to pass to error_log()
30      * @see http://us3.php.net/manual/en/function.error-log.php
31      * @var int
32      */
33     protected $messageType;
34     
35     /**
36      * Extra headers to pass to error_log()
37      * @see http://us3.php.net/manual/en/function.error-log.php
38      * @var string
39      */
40     protected $extraHeaders;
41 
42     public function __construct($path, $messageType = 3, $extraHeaders = '') {
43         $this->path = $path;
44         $this->messageType = $messageType;
45         $this->extraHeaders = $extraHeaders;
46     }
47 
48     /**
49      * Write the log message to the file path set
50      * in this writer.
51      */
52     public function _write($event) {
53         if(!$this->_formatter) {
54             $formatter = new SS_LogErrorFileFormatter();
55             $this->setFormatter($formatter);
56         }
57         $message = $this->_formatter->format($event);
58         error_log($message, $this->messageType, $this->path, $this->extraHeaders);
59     }
60 
61 }
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.2 API Docs API documentation generated by ApiGen 2.8.0