Source for file Log.class.php

Documentation is available at Log.class.php

  1. <?php
  2. /**
  3.  * Gumbo Library Framework
  4.  *
  5.  * LICENSE
  6.  * This library is being released under the terms of the New BSD License.  A
  7.  * copy of the license is packaged with the software (LICENSE.txt).  If no
  8.  * copy is found, a copy of the license template can be found at:
  9.  * http://www.opensource.org/licenses/bsd-license.php
  10.  * 
  11.  * @category Gumbo
  12.  * @package Log
  13.  * @copyright Copyright (c) 2007, iBayou, Michael Luster
  14.  * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
  15.  * @author Michael Luster <mluster79@yahoo.com>
  16.  * @link http://sourceforge.net/projects/phpgumbo
  17.  * @version 0.0.1
  18.  */
  19.  
  20. /**
  21.  * Log Interface
  22.  * 
  23.  * This is responsible for holding Log Message created by the system.  A Log
  24.  * Message Type is defined by the Log Message, which indicates the type of Log
  25.  * Message being created.  The implementing class will have the option to
  26.  * restrict certain Message Types from being written.  This creates an easy way
  27.  * to ignore certain types of Messages.
  28.  *
  29.  * @category Gumbo
  30.  * @package Log
  31.  * @copyright Copyright (c) 2007, iBayou, Michael Luster
  32.  * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
  33.  * @author Michael Luster <mluster79@yahoo.com>
  34.  * @link http://sourceforge.net/projects/phpgumbo
  35.  * @desc Log Interface
  36.  * @version 0.0.1
  37.  */
  38.  
  39. gumbo_load ("Interface_Log_Message");
  40.  
  41. interface Gumbo_Interface_Log {
  42.     
  43.     /** ACTION METHODS **/
  44.     /**
  45.      * Writes the messages to the corresponding Log file
  46.      * @precondition isOn()
  47.      */
  48.     public function write ();
  49.     
  50.     /**
  51.      * Adds a log message to the list
  52.      * @precondition isOn()
  53.      * @param Gumbo_Interface_Log_Message $mess 
  54.      */
  55.     public function add (Gumbo_Interface_Log_Message $mess);
  56.     
  57.     /**
  58.      * Clears the log messages in the system
  59.      */
  60.     public function clear ();
  61.     
  62.     /**
  63.      * Turn on Logging
  64.      * @postcondition isOn()
  65.      */
  66.     public function turnOn ();
  67.     
  68.     /**
  69.      * Turn off Logging
  70.      * @postcondition !isOn()
  71.      */
  72.     public function turnOff ();
  73.     
  74.     /**
  75.      * Adds an active Log Message Type
  76.      * @param string $type 
  77.      */
  78.     public function addType ($type);
  79.     
  80.     /**
  81.      * Removes an active Log Message Type
  82.      * @param string $type 
  83.      */
  84.     public function delType ($type);
  85.     
  86.     /**
  87.      * Resets the types
  88.      */
  89.     public function resetTypes ();
  90.     
  91.     
  92.     
  93.     /** ACCESSOR METHODS **/
  94.     /**
  95.      * Returns all the log messages
  96.      * @return array 
  97.      */
  98.     public function getAll ();
  99.     
  100.     /**
  101.      * Returns if Logging is on
  102.      * @return bool 
  103.      */
  104.     public function isOn ();
  105.     
  106.     /**
  107.      * Returns all available types
  108.      * @return array 
  109.      */
  110.     public function getTypes ();
  111.     
  112.     /**
  113.      * Returns if the message type is registered
  114.      * @param string $type 
  115.      * @return bool 
  116.      */
  117.     public function isType ($type);
  118.     
  119.     /**
  120.      * Returns if to ignore Types (or set to ignore Types)
  121.      * @param bool $ignore 
  122.      * @return bool 
  123.      */
  124.     public function ignoreTypes ($ignore=null);
  125.     
  126. }
  127.  
  128. ?>