TLogRoute is the base class for all log route classes. A log route object retrieves log messages from a logger and sends it somewhere, such as files, emails. The messages being retrieved may be filtered first before being sent to the destination. The filters include log level filter and log category filter. To specify level filter, set {@link setLevels Levels} property, which takes a string of comma-separated desired level names (e.g. 'Error, Debug'). To specify category filter, set {@link setCategories Categories} property, which takes a string of comma-separated desired category names (e.g. 'System.Web, System.IO'). Level filter and category filter are combinational, i.e., only messages satisfying both filter conditions will they be returned.
Since: 3.0
Author: Qiang Xue (qiang.xue@gmail.com)
Inheritance: extends Prado\TApplicationComponent
Exemple #1
0
 /**
  * Adds a TLogRoute instance to the log router.
  *
  * @param TLogRoute $route
  * @throws TInvalidDataTypeException if the route object is invalid
  */
 public function addRoute($route)
 {
     if (!$route instanceof TLogRoute) {
         throw new TInvalidDataTypeException('logrouter_routetype_invalid');
     }
     $this->_routes[] = $route;
     $route->init(null);
 }
Exemple #2
0
 /**
  * Initializes this module.
  * This method is required by the IModule interface.
  * It initializes the database for logging purpose.
  * @param TXmlElement configuration for this module, can be null
  * @throws TConfigurationException if the DB table does not exist.
  */
 public function init($config)
 {
     $db = $this->getDbConnection();
     $db->setActive(true);
     $sql = 'SELECT * FROM ' . $this->_logTable . ' WHERE 0=1';
     try {
         $db->createCommand($sql)->query()->close();
     } catch (Exception $e) {
         // DB table not exists
         if ($this->_autoCreate) {
             $this->createDbTable();
         } else {
             throw new TConfigurationException('db_logtable_inexistent', $this->_logTable);
         }
     }
     parent::init($config);
 }