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

Class SS_Log

Wrapper class for a logging handler like Zend_Log which takes a message (or a map of context variables) and sends it to one or more Zend_Log_Writer_Abstract subclasses for output.

These priorities are currently supported: - SS_Log::ERR - SS_Log::WARN - SS_Log::NOTICE

You can add an error writer by calling SS_Log::add_writer()

Example usage of logging errors by email notification:

SS_Log::add_writer(new SS_LogEmailWriter('my@email.com'), SS_Log::ERR);

Example usage of logging errors by file:

SS_Log::add_writer(new SS_LogFileWriter('/var/log/silverstripe/errors.log'), SS_Log::ERR);

Example usage of logging at warnings and errors by setting the priority to '<=':

SS_Log::add_writer(new SS_LogEmailWriter('my@email.com'), SS_Log::WARN, '<=');

Each writer object can be assigned a formatter. The formatter is responsible for formatting the message before giving it to the writer. SS_LogErrorEmailFormatter is such an example that formats errors into HTML for human readability in an email client.

Formatters are added to writers like this:

$logEmailWriter = new SS_LogEmailWriter('my@email.com');
$myEmailFormatter = new MyLogEmailFormatter();
$logEmailWriter->setFormatter($myEmailFormatter);
Package: sapphire\dev
Located at sapphire/dev/Log.php

Methods summary

public static object
# get_logger( )

Get the logger currently in use, or create a new one if it doesn't exist.

Get the logger currently in use, or create a new one if it doesn't exist.

Returns

object
object
public static array
# get_writers( )

Get all writers in use by the logger.

Get all writers in use by the logger.

Returns

array
Collection of Zend_Log_Writer_Abstract instances
public static
# clear_writers( )

Remove all writers currently in use.

Remove all writers currently in use.

public static
# remove_writer( object $writer )

Remove a writer instance from the logger.

Remove a writer instance from the logger.

Parameters

$writer
object $writer Zend_Log_Writer_Abstract instance
public static
# add_writer( object $writer, const $priority = null, mixed $comparison = '=' )

Add a writer instance to the logger.

Add a writer instance to the logger.

Parameters

$writer
object $writer Zend_Log_Writer_Abstract instance
$priority
const $priority Priority. Possible values: SS_Log::ERR, SS_Log::WARN or SS_Log::NOTICE
$comparison
$comparison Priority comparison operator. Acts on the integer values of the error levels, where more serious errors are lower numbers. By default this is "=", which means only the given priority will be logged. Set to "<=" if you want to track errors of at least the given priority.
public static
# log( mixed $message, const $priority )

Dispatch a message by priority level.

Dispatch a message by priority level.

The message parameter can be either a string (a simple error message), or an array of variables. The latter is useful for passing along a list of debug information for the writer to handle, such as error code, error line, error context (backtrace).

Parameters

$message
mixed $message Exception object or array of error context variables
$priority
const $priority Priority. Possible values: SS_Log::ERR, SS_Log::WARN or SS_Log::NOTICE

Magic methods summary

Constants summary

string ERR Zend_Log::ERR
#
string WARN Zend_Log::WARN
#
string NOTICE Zend_Log::NOTICE
#

Properties summary

public static string $logger_class
#

Logger class to use.

Logger class to use.

See

SS_Log::get_logger()
protected static object $logger
#

See

SS_Log::get_logger()
[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