* one were written by Mike Naberezny and Chuck Hagenbuch.
*
* @category Horde
- * @package Horde_Log
+ * @package Log
* @author Mike Naberezny <mike@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
* @license http://opensource.org/licenses/bsd-license.php BSD
/**
* @category Horde
- * @package Horde_Log
+ * @package Log
*/
class Horde_Log {
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @package Horde_Log
* @author Mike Naberezny <mike@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
* @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
*/
/**
- * @package Horde_Log
* @author Mike Naberezny <mike@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
* @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
*/
class Horde_Log_Exception extends Exception {}
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Filters
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @category Horde
+ * @subpackage Filters
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Filters
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
interface Horde_Log_Filter
{
* Returns Horde_Log_Filter::ACCEPT to accept the message,
* Horde_Log_Filter::IGNORE to ignore it.
*
- * @param array $event Log event
- * @return boolean accepted?
+ * @param array $event Log event.
+ *
+ * @return boolean Accepted?
*/
public function accept($event);
+
}
<?php
/**
- * @category Horde
- * @package Horde_Log
+ * @author James Pepin <james@jamespepin.com>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Filters
- * @author James Pepin <james@jamespepin.com>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
* Filters log events using defined constraints on one or more fields of the
- * $event array
+ * $event array.
*
- * @category Horde
- * @package Horde_Log
+ * @author James Pepin <james@jamespepin.com>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Filters
- * @author James Pepin <james@jamespepin.com>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*
* @todo Implement constraint objects for the different types of filtering ie
* regex,required,type..etc.. so we can add different constaints ad infinitum.
class Horde_Log_Filter_Constraint implements Horde_Log_Filter
{
/**
+ * Constraint list.
+ *
* @var array
*/
protected $_constraints = array();
/**
+ * Default constraint coupler.
+ *
* @var Horde_Constraint_Coupler
* @default Horde_Constraint_And
*/
/**
* Constructor
*
- * @param Horde_Constraint_Coupler $coupler The default kind of constraint
- * to use to couple multiple constraints. Defaults to And.
+ * @param Horde_Constraint_Coupler $coupler The default kind of
+ * constraint to use to couple
+ * multiple constraints.
+ * Defaults to And.
*/
public function __construct(Horde_Constraint_Coupler $coupler = null)
{
- if (is_null($coupler)) {
- $coupler = new Horde_Constraint_And();
- }
- $this->_coupler = $coupler;
+ $this->_coupler = is_null($coupler)
+ ? new Horde_Constraint_And()
+ : $coupler;
}
/**
* Add a constraint to the filter
*
- * @param string $field The field to apply the constraint to
- * @param Horde_Constraint $constraint The constraint to apply
+ * @param string $field The field to apply the constraint
+ * to.
+ * @param Horde_Constraint $constraint The constraint to apply.
*
- * @return Horde_Log_Filter_Constraint A reference to $this to allow method chaining
+ * @return Horde_Log_Filter_Constraint A reference to $this to allow
+ * method chaining.
*/
public function addConstraint($field, Horde_Constraint $constraint)
{
$this->_constraints[$field] = clone($this->_coupler);
}
$this->_constraints[$field]->addConstraint($constraint);
+
return $this;
}
* Takes a field name and a regex, if the regex does not match then the
* event is filtered.
*
- * @param string $field The name of the field that should be part of the event
- * @param string $regex The regular expression to filter by
- * @return Horde_Log_Filter_Constraint A reference to $this to allow method chaining
+ * @param string $field The name of the field that should be part of the
+ * event.
+ * @param string $regex The regular expression to filter by.
+ * @return Horde_Log_Filter_Constraint A reference to $this to allow
+ * method chaining.
*/
public function addRegex($field, $regex)
{
- $constraint = new Horde_Constraint_PregMatch($regex);
- return $this->addConstraint($field, $constraint);
+ return $this->addConstraint($field, new Horde_Constraint_PregMatch($regex));
}
/**
*
* If the field does not exist on the event, then it is filtered.
*
- * @param string $field The name of the field that should be part of the event
- * @return Horde_Log_Filter_Constraint A reference to $this to allow method chaining
+ * @param string $field The name of the field that should be part of the
+ * event.
+ *
+ * @return Horde_Log_Filter_Constraint A reference to $this to allow
+ * method chaining.
*/
public function addRequiredField($field)
{
- $notNull = new Horde_Constraint_Not(new Horde_Constraint_Null());
- return $this->addConstraint($field, $notNull);
+ return $this->addConstraint($field, new Horde_Constraint_Not(new Horde_Constraint_Null()));
}
/**
* Adds all arguments passed as required fields
*
- * @return Horde_Log_Filter_Constraint A reference to $this to allow method chaining
+ * @return Horde_Log_Filter_Constraint A reference to $this to allow
+ * method chaining.
*/
public function addRequiredFields()
{
- $fields = func_get_args();
- foreach ($fields as $f) {
+ foreach (func_get_args() as $f) {
$this->addRequiredField($f);
}
+
return $this;
}
* Returns Horde_Log_Filter::ACCEPT to accept the message,
* Horde_Log_Filter::IGNORE to ignore it.
*
- * @param array $event Log event
- * @return boolean accepted?
+ * @param array $event Log event.
+ *
+ * @return boolean accepted?
*/
public function accept($event)
{
return Horde_Log_Filter::IGNORE;
}
}
+
return Horde_Log_Filter::ACCEPT;
}
+
}
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Filters
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Filters
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Filter_Level implements Horde_Log_Filter
{
/**
+ * Filter level.
+ *
* @var integer
*/
protected $_level;
/**
* Filter out any log messages greater than $level.
*
- * @param integer $level Maximum log level to pass through the filter
+ * @param integer $level Maximum log level to pass through the filter.
+ *
+ * @throws InvalidArgumentException
*/
public function __construct($level)
{
- if (! is_integer($level)) {
- throw new Horde_Log_Exception('Level must be an integer');
+ if (!is_integer($level)) {
+ throw new InvalidArgumentException('Level must be an integer');
}
$this->_level = $level;
* Returns Horde_Log_Filter::ACCEPT to accept the message,
* Horde_Log_Filter::IGNORE to ignore it.
*
- * @param array $event Log event
- * @return boolean accepted?
+ * @param array $event Log event.
+ *
+ * @return boolean Accepted?
*/
public function accept($event)
{
- return $event['level'] <= $this->_level;
+ return ($event['level'] <= $this->_level);
}
+
}
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Filters
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Filters
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Filter_Message implements Horde_Log_Filter
{
/**
+ * Filter regex.
+ *
* @var string
*/
protected $_regexp;
/**
* Filter out any log messages not matching $regexp.
*
- * @param string $regexp Regular expression to test the log message
- * @throws Horde_Log_Exception Invalid regular expression
+ * @param string $regexp Regular expression to test the log message.
+ *
+ * @throws InvalidArgumentException Invalid regular expression.
*/
public function __construct($regexp)
{
if (@preg_match($regexp, '') === false) {
- throw new Horde_Log_Exception("Invalid regular expression '$regexp'");
+ throw new InvalidArgumentException('Invalid regular expression ' . $regexp);
}
+
$this->_regexp = $regexp;
}
* Returns Horde_Log_Filter::ACCEPT to accept the message,
* Horde_Log_Filter::IGNORE to ignore it.
*
- * @param array $event Log event
- * @return boolean accepted?
+ * @param array $event Log event.
+ *
+ * @return boolean Accepted?
*/
public function accept($event)
{
- return preg_match($this->_regexp, $event['message']) > 0;
+ return (preg_match($this->_regexp, $event['message']) > 0);
}
+
}
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Filters
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Filters
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Filter_Suppress implements Horde_Log_Filter
{
/**
+ * Accept all events?
+ *
* @var boolean
*/
protected $_accept = Horde_Log_Filter::ACCEPT;
/**
* This is a simple boolean filter.
*
- * Call suppress(true) to suppress all log events.
- * Call suppress(false) to accept all log events.
- *
- * @param boolean $suppress Should all log events be suppressed?
- * @return void
+ * @param boolean $suppress Should all log events be suppressed?
*/
public function suppress($suppress)
{
- $this->_accept = (! $suppress);
+ $this->_accept = !$suppress;
}
/**
* Returns Horde_Log_Filter::ACCEPT to accept the message,
* Horde_Log_Filter::IGNORE to ignore it.
*
- * @param array $event event data
- * @return boolean accepted?
+ * @param array $event Event data.
+ *
+ * @return boolean Accepted?
*/
public function accept($event)
{
return $this->_accept;
}
+
}
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @package Horde_Log
* @author Mike Naberezny <mike@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
* @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
*/
/**
- * @package Horde_Log
* @author Mike Naberezny <mike@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
* @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
*/
interface Horde_Log_Formatter
{
/**
* Formats an event to be written by the handler.
*
- * @param array $event Log event
- * @return string formatted line
+ * @param array $event Log event.
+ *
+ * @return string Formatted line.
*/
public function format($event);
+
}
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Formatters
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Formatters
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Formatter_Simple implements Horde_Log_Formatter
{
/**
- * Format string
+ * Format string.
*
* @var string
*/
/**
* Constructor.
*
- * @param array $options Configuration Options:
+ * @param array $options Configuration options:
* <pre>
* 'format' - (string) The log template.
* </pre>
+ *
+ * @throws InvalidArgumentException
*/
public function __construct($options = null)
{
- if (is_array($options) && isset($options['format'])) {
- $format = $options['format'];
- } else {
- $format = $options;
- }
+ $format = (is_array($options) && isset($options['format']))
+ ? $options['format']
+ : $options;
if (is_null($format)) {
$format = '%timestamp% %levelName%: %message%' . PHP_EOL;
}
if (!is_string($format)) {
- throw new Horde_Log_Exception('Format must be a string');
+ throw new InvalidArgumentException('Format must be a string');
}
$this->_format = $format;
/**
* Formats an event to be written by the handler.
*
- * @param array $event Log event
- * @return string formatted line
+ * @param array $event Log event.
+ *
+ * @return string Formatted line.
*/
public function format($event)
{
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Formatters
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Formatters
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Formatter_Xml implements Horde_Log_Formatter
{
- protected $_options = array('elementEntry' => 'log',
- 'elementTimestamp' => 'timestamp',
- 'elementMessage' => 'message',
- 'elementLevel' => 'level',
- 'lineEnding' => PHP_EOL);
+ /**
+ * Config options.
+ *
+ * @var array
+ */
+ protected $_options = array(
+ 'elementEntry' => 'log',
+ 'elementTimestamp' => 'timestamp',
+ 'elementMessage' => 'message',
+ 'elementLevel' => 'level',
+ 'lineEnding' => PHP_EOL
+ );
+ /**
+ * Constructor.
+ *
+ * TODO
+ */
public function __construct($options = array())
{
$this->_options = array_merge($this->_options, $options);
/**
* Formats an event to be written by the handler.
*
- * @param array $event Log event
- * @return string XML string
+ * @param array $event Log event.
+ *
+ * @return string XML string.
*/
public function format($event)
{
$elt->appendChild(new DOMElement($this->_options['elementMessage'], $event['message']));
$elt->appendChild(new DOMElement($this->_options['elementLevel'], $event['level']));
- $xml = $dom->saveXML();
- $xml = preg_replace('/<\?xml version="1.0"( encoding="[^\"]*")?\?>\n/u', '', $xml);
-
- return $xml . $this->_options['lineEnding'];
+ return preg_replace('/<\?xml version="1.0"( encoding="[^\"]*")?\?>\n/u', '', $dom->saveXML()) . $this->_options['lineEnding'];
}
}
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Handlers
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Handlers
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
abstract class Horde_Log_Handler_Base
{
/**
- * @var array of key/value pair options
+ * Options.
+ *
+ * @var array
*/
protected $_options = array();
/**
- * @var array of Horde_Log_Filter
+ * List of filter objects.
+ *
+ * @var array
*/
protected $_filters = array();
/**
* Add a filter specific to this handler.
*
- * @param Horde_Log_Filter $filter
- * @return void
+ * @param Horde_Log_Filter $filter Filter to add.
*/
public function addFilter($filter)
{
- if (is_integer($filter)) {
- $filter = new Horde_Log_Filter_Level($filter);
- }
-
- $this->_filters[] = $filter;
+ $this->_filters[] = is_integer($filter)
+ ? new Horde_Log_Filter_Level($filter)
+ : $filter;
}
/**
* Log a message to this handler.
*
- * @param array $event Log event
- * @return void
+ * @param array $event Log event.
*/
public function log($event)
{
- // if any local filter rejects the message, don't log it.
+ // If any local filter rejects the message, don't log it.
foreach ($this->_filters as $filter) {
if (!$filter->accept($event)) {
return;
/**
* Sets an option specific to the implementation of the log handler.
*
- * @param $optionKey Key name for the option to be changed. Keys are handler-specific
- * @param $optionValue New value to assign to the option
- * @return bool True
+ * @param string $optionKey Key name for the option to be changed. Keys
+ * are handler-specific.
+ * @param mixed $optionValue New value to assign to the option
+ *
+ * @return boolean True.
+ * @throws Horde_Log_Exception
*/
public function setOption($optionKey, $optionValue)
{
if (!isset($this->_options[$optionKey])) {
- throw new Horde_Log_Exception("Unknown option \"$optionKey\".");
+ throw new Horde_Log_Exception('Unknown option "' . $optionKey . '".');
}
$this->_options[$optionKey] = $optionValue;
}
/**
- * Buffer a message to be stored in the storage
- * implemented by this handler.
+ * Buffer a message to be stored in the storage.
*
- * @param array $event Log event
+ * @param array $event Log event.
*/
abstract public function write($event);
+
}
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Handlers
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Handlers
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Handler_Db extends Horde_Log_Handler_Base
{
/**
- * Database adapter instance
+ * Database adapter instance.
+ *
* @var Horde_Db_Adapter
*/
private $_db;
/**
- * Name of the log table in the database
+ * Name of the log table in the database.
+ *
* @var string
*/
private $_table;
/**
- * Options to be set by setOption(). Sets the field names in the database table.
+ * Options to be set by setOption().
+ * Sets the field names in the database table.
*
* @var array
*/
- protected $_options = array('fieldMessage' => 'message',
- 'fieldLevel' => 'level');
+ protected $_options = array(
+ 'fieldMessage' => 'message',
+ 'fieldLevel' => 'level'
+ );
/**
- * Class constructor
+ * Constructor.
*
- * @param Horde_Db_Adapter $db Database adapter instance
- * @param string $table Log table in database
+ * @param Horde_Db_Adapter $db Database adapter instance.
+ * @param string $table Log table in database.
*/
public function __construct($db, $table)
{
- $this->_db = $db;
+ $this->_db = $db;
$this->_table = $table;
}
/**
* Write a message to the log.
*
- * @param array $event Log event
- * @return bool Always True
+ * @param array $event Log event.
+ *
+ * @return bool True.
*/
public function write($event)
{
);
$this->_db->insert($this->_table, $fields);
+
return true;
}
/**
* Horde Log package
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Handlers
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Handlers
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Handler_Firebug extends Horde_Log_Handler_Base
{
/**
* Formats the log message before writing.
+ *
* @var Horde_Log_Formatter
*/
protected $_formatter;
/**
- * Options to be set by setOption(). Sets the field names in the database table.
+ * Options to be set by setOption().
*
* @var array
*/
- protected $_options = array('buffering' => false);
+ protected $_options = array(
+ 'buffering' => false
+ );
/**
* Array of buffered output.
+ *
* @var string
*/
protected $_buffer = array();
/**
* Mapping of log priorities to Firebug methods.
+ *
* @var array
- * @access private
*/
protected static $_methods = array(
Horde_Log::EMERG => 'error',
/**
* Class Constructor
*
- * @param Horde_Log_Formatter $formatter Log formatter
+ * @param Horde_Log_Formatter $formatter Log formatter.
*/
public function __construct(Horde_Log_Formatter $formatter = null)
{
- if (is_null($formatter)) {
- $formatter = new Horde_Log_Formatter_Simple();
- }
- $this->_formatter = $formatter;
+ $this->_formatter = is_null($formatter)
+ ? new Horde_Log_Formatter_Simple()
+ : $formatter;
}
/**
- * Write a message to the firebug console. This function really just writes
- * the message to the buffer. If buffering is enabled, the
+ * Write a message to the firebug console. This function really just
+ * writes the message to the buffer. If buffering is enabled, the
* message won't be output until the buffer is flushed. If
* buffering is not enabled, the buffer will be flushed
* immediately.
*
- * @param array $event Log event
- * @return bool Always True
+ * @param array $event Log event.
+ *
+ * @return boolean True.
*/
public function write($event)
{
}
/**
+ * Flush the buffer.
*/
public function flush()
{
foreach ($this->_buffer as $event) {
$line = trim($this->_formatter->format($event));
- // normalize line breaks
+ // Normalize line breaks.
$line = str_replace("\r\n", "\n", $line);
- // escape line breaks
+ // Escape line breaks
$line = str_replace("\n", "\\n\\\n", $line);
- // escape quotes
+ // Escape quotes.
$line = str_replace('"', '\\"', $line);
- // firebug call
- $method = isset(self::$_methods[$event['level']]) ? self::$_methods[$event['level']] : 'log';
+ // Firebug call.
+ $method = isset(self::$_methods[$event['level']])
+ ? self::$_methods[$event['level']]
+ : 'log';
$output[] = 'console.' . $method . '("' . $line . '");';
}
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Handlers
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Handlers
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Handler_Mock extends Horde_Log_Handler_Base
{
/**
- * array of log events
+ * Log events.
+ *
+ * @var array
*/
public $events = array();
/**
- * shutdown called?
+ * Was shutdown called?
+ *
+ * @var boolean
*/
public $shutdown = false;
/**
* Write a message to the log.
*
- * @param array $event event data
- * @return void
+ * @param array $event Event data.
*/
public function write($event)
{
/**
* Record shutdown
- *
- * @return void
*/
public function shutdown()
{
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Handlers
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Handlers
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Handler_Null extends Horde_Log_Handler_Base
{
/**
- * Write a message to the log buffer
+ * Write a message to the log buffer.
+ *
+ * @return boolean True.
*/
public function write($event)
{
return true;
}
-}
\ No newline at end of file
+}
/**
* Horde Log package
*
- * @category Horde
- * @package Horde_Log
- * @subpackage Handlers
* @author Mike Naberezny <mike@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
* @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
+ * @subpackage Handlers
*/
/**
- * @category Horde
- * @package Horde_Log
- * @subpackage Handlers
* @author Mike Naberezny <mike@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
* @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
+ * @subpackage Handlers
*/
class Horde_Log_Handler_Scribe extends Horde_Log_Handler_Base
{
/**
- * Scribe client
+ * Scribe client.
+ *
* @var Horde_Scribe_Client
*/
protected $_scribe;
/**
* Formats the log message before writing.
+ *
* @var Horde_Log_Formatter
*/
protected $_formatter;
/**
* Options to be set by setOption().
+ *
* @var array
*/
protected $_options = array(
- 'category' => 'default',
'addNewline' => false,
+ 'category' => 'default'
);
/**
- * Class Constructor
+ * Constructor.
*
- * @param Horde_Scribe_Client $scribe Scribe client
- * @param Horde_Log_Formatter $formatter Log formatter
+ * @param Horde_Scribe_Client $scribe Scribe client.
+ * @param Horde_Log_Formatter $formatter Log formatter.
*/
public function __construct(Horde_Scribe_Client $scribe,
Horde_Log_Formatter $formatter = null)
{
- if (is_null($formatter)) {
- $formatter = new Horde_Log_Formatter_Simple();
- }
-
+ $this->_formatter = is_null($formatter)
+ ? new Horde_Log_Formatter_Simple()
+ : $formatter;
$this->_scribe = $scribe;
- $this->_formatter = $formatter;
}
/**
* Write a message to the log.
*
- * @param array $event Log event
- * @return bool Always True
+ * @param array $event Log event.
+ *
+ * @return boolean True.
*/
public function write($event)
{
- $category = isset($event['category']) ? $event['category'] : $this->_options['category'];
+ $category = isset($event['category'])
+ ? $event['category']
+ : $this->_options['category'];
$message = $this->_formatter->format($event);
if (!$this->_options['addNewline']) {
return true;
}
+
}
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Handlers
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage Handlers
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Handler_Stream extends Horde_Log_Handler_Base
{
/**
* Formats the log message before writing.
+ *
* @var Horde_Log_Formatter
*/
protected $_formatter;
/**
* Holds the PHP stream to log to.
+ *
* @var null|stream
*/
protected $_stream = null;
/**
* Class Constructor
*
- * @param mixed $streamOrUrl Stream or URL to open as a stream.
- * @param string $mode Mode, only applicable if a URL is given.
+ * @param mixed $streamOrUrl Stream or URL to open as a
+ * stream.
+ * @param string $mode Mode, only applicable if a URL
+ * is given.
* @param Horde_Log_Formatter $formatter Log formatter.
+ *
+ * @throws Horde_Log_Exception
*/
public function __construct($streamOrUrl, $mode = 'a+',
Horde_Log_Formatter $formatter = null)
{
- if (is_null($formatter)) {
- $formatter = new Horde_Log_Formatter_Simple();
- }
-
- $this->_formatter = $formatter;
+ $this->_formatter = is_null($formatter)
+ ? new Horde_Log_Formatter_Simple()
+ : $formatter;
$this->_mode = $mode;
$this->_streamOrUrl = $streamOrUrl;
/**
* Wakup function - reattaches stream.
+ *
+ * @throws Horde_Log_Exception
*/
public function __wakeup()
{
/**
* Write a message to the log.
*
- * @param array $event Log event
- * @return bool Always True
+ * @param array $event Log event.
+ *
+ * @return boolean True.
+ * @throws Horde_Log_Exception
*/
public function write($event)
{
/**
* Horde Log package
*
- * @category Horde
- * @package Horde_Log
- * @subpackage Handlers
* @author Mike Naberezny <mike@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
* @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
+ * @subpackage Handlers
*/
/**
- * @category Horde
- * @package Horde_Log
- * @subpackage Handlers
* @author Mike Naberezny <mike@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
* @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
+ * @subpackage Handlers
*/
class Horde_Log_Handler_Syslog extends Horde_Log_Handler_Base
{
/**
- * Options to be set by setOption(). Sets openlog and syslog options.
+ * Options to be set by setOption().
+ * Sets openlog and syslog options.
+ *
* @var array
*/
protected $_options = array(
- 'ident' => false,
- 'facility' => LOG_USER,
- 'openlogOptions' => false,
'defaultPriority' => LOG_ERR,
+ 'facility' => LOG_USER,
+ 'ident' => false,
+ 'openlogOptions' => false
);
/**
- * Last ident set by a syslog-handler instance
+ * Last ident set by a syslog-handler instance.
+ *
* @var string
*/
protected static $_lastIdent;
/**
- * Last facility name set by a syslog-handler instance
+ * Last facility name set by a syslog-handler instance.
+ *
* @var string
*/
protected static $_lastFacility;
/**
- * Map of log levels to syslog priorities
+ * Map of log levels to syslog priorities.
+ *
* @var array
*/
protected $_priorities = array(
/**
* Write a message to the log.
*
- * @param array $event Log event
- * @return bool Always True
+ * @param array $event Log event.
+ *
+ * @return boolean True.
+ * @throws Horde_Log_Exception
*/
public function write($event)
{
- if ($this->_options['ident'] !== self::$_lastIdent ||
- $this->_options['facility'] !== self::$_lastFacility) {
+ if (($this->_options['ident'] !== $this->_lastIdent) ||
+ ($this->_options['facility'] !== $this->_lastFacility)) {
$this->_initializeSyslog();
}
$priority = $this->_toSyslog($event['level']);
- if (! syslog($priority, $event['message'])) {
+ if (!syslog($priority, $event['message'])) {
throw new Horde_Log_Exception('Unable to log message');
}
/**
* Translate a log level to a syslog LOG_* priority.
*
- * @param integer $level
+ * @param integer $level Log level.
*
- * @return integer A LOG_* constant
+ * @return integer A LOG_* constant.
*/
protected function _toSyslog($level)
{
if (isset($this->_priorities[$level])) {
return $this->_priorities[$level];
}
+
return $this->_options['defaultPriority'];
}
/**
- * Initialize syslog / set ident and facility
+ * Initialize syslog / set ident and facility.
*
- * @param string $ident ident
- * @param string $facility syslog facility
- * @return void
+ * @param string $ident Ident.
+ * @param string $facility Syslog facility.
+ *
+ * @throws Horde_Log_Exception
*/
protected function _initializeSyslog()
{
- self::$_lastIdent = $this->_options['ident'];
- self::$_lastFacility = $this->_options['facility'];
- if (! openlog($this->_options['ident'], $this->_options['openlogOptions'], $this->_options['facility'])) {
+ $this->_lastIdent = $this->_options['ident'];
+ $_this->lastFacility = $this->_options['facility'];
+
+ if (!openlog($this->_options['ident'], $this->_options['openlogOptions'], $this->_options['facility'])) {
throw new Horde_Log_Exception('Unable to open syslog');
}
}
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
* @author Mike Naberezny <mike@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
* @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
*/
/**
- * @category Horde
- * @package Horde_Log
* @author Mike Naberezny <mike@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
* @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
*
* @method void LOGLEVEL() LOGLEVEL($event) Log an event at LOGLEVEL, where LOGLEVEL has been added with addLevel() or already exists
* @method void emerg() emerg($event) Log an event at the EMERG log level
class Horde_Log_Logger
{
/**
- * @var array of log levels where the keys are the
- * level priorities and the values are the level names
+ * Log levels where the keys are the level priorities and the values are
+ * the level names.
+ *
+ * @var array
*/
private $_levels = array();
/**
- * @var array of Horde_Log_Handler_Base objects
+ * Horde_Log_Handler_Base objects.
+ *
+ * @var array
*/
private $_handlers = array();
/**
- * @var array of Horde_Log_Filter objects
+ * Horde_Log_Filter objects.
+ *
+ * @var array
*/
private $_filters = array();
/**
- * Class constructor. Create a new logger
+ * Constructor.
*
- * @param Horde_Log_Handler_Base|null $handler default handler
+ * @param Horde_Log_Handler_Base|null $handler Default handler.
*/
public function __construct($handler = null)
{
$r = new ReflectionClass('Horde_Log');
$this->_levels = array_flip($r->getConstants());
- if ($handler !== null) {
+ if (!is_null($handler)) {
$this->addHandler($handler);
}
}
/**
* Undefined method handler allows a shortcut:
- * $log->levelName('message')
- * instead of
- * $log->log('message', Horde_Log_LEVELNAME)
+ * <pre>
+ * $log->levelName('message');
+ * instead of
+ * $log->log('message', Horde_Log_LEVELNAME);
+ * </pre>
*
- * @param string $method log level name
- * @param string $params message to log
- * @return void
+ * @param string $method Log level name.
+ * @param string $params Message to log.
*/
public function __call($method, $params)
{
/**
* Log a message at a level
*
- * @param mixed $event Message to log, either an array or a string
- * @param integer $level Log level of message, required if $message is a string
- * @return void
+ * @param mixed $event Message to log, either an array or a string.
+ * @param integer $level Log level of message, required if $message is a
+ * string.
*/
public function log($event, $level = null)
{
throw new Horde_Log_Exception('Event array did not contain a message');
}
if (!isset($event['level'])) {
- if ($level === null) {
+ if (is_null($level)) {
throw new Horde_Log_Exception('Event array did not contain a log level');
- } else {
- $event['level'] = $level;
}
+ $event['level'] = $level;
}
} else {
// Create an event array from the message and level
throw new Horde_Log_Exception('Bad log level: ' . $event['level']);
}
- // Fill in the level name and timestamp for filters, formatters, handlers
+ // Fill in the level name and timestamp for filters, formatters,
+ // handlers.
$event['levelName'] = $this->_levels[$event['level']];
if (!isset($event['timestamp'])) {
/**
* Does this logger have the level $name already?
*
- * @param string $name The level name to check for
- * @return boolean Whether the logger already has the specific level name
+ * @param string $name The level name to check for.
+ *
+ * @return boolean Whether the logger already has the specific level
+ * name.
*/
public function hasLevel($name)
{
/**
* Add a custom log level
*
- * @param string $name Name of level
- * @param integer $level Numeric level
- * @return void
+ * @param string $name Name of level.
+ * @param integer $level Numeric level.
*/
public function addLevel($name, $level)
{
* Before a message will be received by any of the handlers, it
* must be accepted by all filters added with this method.
*
- * @param Horde_Log_Filter $filter
- * @return void
+ * @param Horde_Log_Filter $filter Filter to add.
*/
public function addFilter($filter)
{
- if (is_integer($filter)) {
- $filter = new Horde_Log_Filter_Level($filter);
- }
-
- $this->_filters[] = $filter;
+ $this->_filters[] = is_integer($filter)
+ ? new Horde_Log_Filter_Level($filter)
+ : $filter;
}
/**
* Add a handler. A handler is responsible for taking a log
* message and writing it out to storage.
*
- * @param Horde_Log_Handler_Base $handler
- * @return void
+ * @param Horde_Log_Handler_Base $handler Handler to add.
*/
public function addHandler($handler)
{
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
require_once 'Horde/Test/AllTests.php';
/**
- * @package Horde_Log
+ * @category Horde
+ * @package Log
* @subpackage UnitTests
*/
class Horde_Log_AllTests extends Horde_Test_AllTests
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Filter_ChainingTest extends PHPUnit_Framework_TestCase
{
/**
* Horde Log package
*
- * @category Horde
- * @package Horde_Log
+ * @author James Pepin <james@jamespepin.com>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author James Pepin <james@jamespepin.com>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author James Pepin <james@jamespepin.com>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author James Pepin <james@jamespepin.com>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Filter_ConstraintTest extends Horde_Test_Case
{
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Filter_LevelTest extends PHPUnit_Framework_TestCase
{
new Horde_Log_Filter_Level('foo');
$this->fail();
} catch (Exception $e) {
- $this->assertType('Horde_Log_Exception', $e);
+ $this->assertType('InvalidArgumentException', $e);
$this->assertRegExp('/must be an integer/i', $e->getMessage());
}
}
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Filter_MessageTest extends PHPUnit_Framework_TestCase
{
try {
$filter = new Horde_Log_Filter_Message('invalid regexp');
$this->fail();
- } catch (Horde_Log_Exception $e) {
+ } catch (InvalidArgumentException $e) {
$this->assertRegexp('/invalid reg/i', $e->getMessage());
}
}
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
- */
+ */
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
- */
-class Horde_Log_Filter_SuppressTest extends PHPUnit_Framework_TestCase
+ */
+class Horde_Log_Filter_SuppressTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
$this->filter = new Horde_Log_Filter_Suppress();
}
-
+
public function testSuppressIsInitiallyOff()
{
$this->assertTrue($this->filter->accept(array()));
$this->assertTrue($this->filter->accept(array()));
$this->assertTrue($this->filter->accept(array()));
}
-
+
public function testSuppressCanBeReset()
{
$this->filter->suppress(true);
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Formatter_SimpleTest extends PHPUnit_Framework_TestCase
{
new Horde_Log_Formatter_Simple(1);
$this->fail();
} catch (Exception $e) {
- $this->assertType('Horde_Log_Exception', $e);
+ $this->assertType('InvalidArgumentException', $e);
$this->assertRegExp('/must be a string/i', $e->getMessage());
}
}
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
* @author Mike Naberezny <mike@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
* @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
*/
/**
- * @category Horde
- * @package Horde_Log
* @author Mike Naberezny <mike@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
* @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
*/
class Horde_Log_Formatter_XmlTest extends PHPUnit_Framework_TestCase
{
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Handler_DbTest extends PHPUnit_Framework_TestCase
{
{
$this->calls[$method][] = $params;
}
-}
\ No newline at end of file
+}
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Handler_FirebugTest extends PHPUnit_Framework_TestCase
{
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Handler_NullTest extends PHPUnit_Framework_TestCase
{
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_Handler_StreamTest extends PHPUnit_Framework_TestCase
{
* (http://framework.zend.com). Both that package and this
* one were written by Mike Naberezny and Chuck Hagenbuch.
*
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
/**
- * @category Horde
- * @package Horde_Log
+ * @author Mike Naberezny <mike@maintainable.com>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ * @package Log
* @subpackage UnitTests
- * @author Mike Naberezny <mike@maintainable.com>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @license http://opensource.org/licenses/bsd-license.php BSD
*/
class Horde_Log_LogTest extends PHPUnit_Framework_TestCase
{