PageRenderTime 78ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/drupal/sites/all/modules/civicrm/packages/Log.php

https://github.com/michaelmcandrew/ste
PHP | 859 lines | 287 code | 65 blank | 507 comment | 32 complexity | 247f4a56a83fbb5c2dacb680d74685b4 MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * $Header$
  4. * $Horde: horde/lib/Log.php,v 1.15 2000/06/29 23:39:45 jon Exp $
  5. *
  6. * @version $Revision: 284340 $
  7. * @package Log
  8. */
  9. define('PEAR_LOG_EMERG', 0); /* System is unusable */
  10. define('PEAR_LOG_ALERT', 1); /* Immediate action required */
  11. define('PEAR_LOG_CRIT', 2); /* Critical conditions */
  12. define('PEAR_LOG_ERR', 3); /* Error conditions */
  13. define('PEAR_LOG_WARNING', 4); /* Warning conditions */
  14. define('PEAR_LOG_NOTICE', 5); /* Normal but significant */
  15. define('PEAR_LOG_INFO', 6); /* Informational */
  16. define('PEAR_LOG_DEBUG', 7); /* Debug-level messages */
  17. define('PEAR_LOG_ALL', 0xffffffff); /* All messages */
  18. define('PEAR_LOG_NONE', 0x00000000); /* No message */
  19. /* Log types for PHP's native error_log() function. */
  20. define('PEAR_LOG_TYPE_SYSTEM', 0); /* Use PHP's system logger */
  21. define('PEAR_LOG_TYPE_MAIL', 1); /* Use PHP's mail() function */
  22. define('PEAR_LOG_TYPE_DEBUG', 2); /* Use PHP's debugging connection */
  23. define('PEAR_LOG_TYPE_FILE', 3); /* Append to a file */
  24. /**
  25. * The Log:: class implements both an abstraction for various logging
  26. * mechanisms and the Subject end of a Subject-Observer pattern.
  27. *
  28. * @author Chuck Hagenbuch <chuck@horde.org>
  29. * @author Jon Parise <jon@php.net>
  30. * @since Horde 1.3
  31. * @package Log
  32. */
  33. class Log
  34. {
  35. /**
  36. * Indicates whether or not the log can been opened / connected.
  37. *
  38. * @var boolean
  39. * @access protected
  40. */
  41. var $_opened = false;
  42. /**
  43. * Instance-specific unique identification number.
  44. *
  45. * @var integer
  46. * @access protected
  47. */
  48. var $_id = 0;
  49. /**
  50. * The label that uniquely identifies this set of log messages.
  51. *
  52. * @var string
  53. * @access protected
  54. */
  55. var $_ident = '';
  56. /**
  57. * The default priority to use when logging an event.
  58. *
  59. * @var integer
  60. * @access protected
  61. */
  62. var $_priority = PEAR_LOG_INFO;
  63. /**
  64. * The bitmask of allowed log levels.
  65. *
  66. * @var integer
  67. * @access protected
  68. */
  69. var $_mask = PEAR_LOG_ALL;
  70. /**
  71. * Holds all Log_observer objects that wish to be notified of new messages.
  72. *
  73. * @var array
  74. * @access protected
  75. */
  76. var $_listeners = array();
  77. /**
  78. * Maps canonical format keys to position arguments for use in building
  79. * "line format" strings.
  80. *
  81. * @var array
  82. * @access protected
  83. */
  84. var $_formatMap = array('%{timestamp}' => '%1$s',
  85. '%{ident}' => '%2$s',
  86. '%{priority}' => '%3$s',
  87. '%{message}' => '%4$s',
  88. '%{file}' => '%5$s',
  89. '%{line}' => '%6$s',
  90. '%{function}' => '%7$s',
  91. '%{class}' => '%8$s',
  92. '%\{' => '%%{');
  93. /**
  94. * Utility function which wraps PHP's class_exists() function to ensure
  95. * consistent behavior between PHP versions 4 and 5. Autoloading behavior
  96. * is always disabled.
  97. *
  98. * @param string $class The name of the class whose existence should
  99. * be tested.
  100. *
  101. * @return bool True if the class exists.
  102. *
  103. * @access private
  104. * @since Log 1.9.13
  105. */
  106. function _classExists($class)
  107. {
  108. if (version_compare(PHP_VERSION, '5.0.0', 'ge')) {
  109. return class_exists($class, false);
  110. }
  111. return class_exists($class);
  112. }
  113. /**
  114. * Attempts to return a concrete Log instance of type $handler.
  115. *
  116. * @param string $handler The type of concrete Log subclass to return.
  117. * Attempt to dynamically include the code for
  118. * this subclass. Currently, valid values are
  119. * 'console', 'syslog', 'sql', 'file', and 'mcal'.
  120. *
  121. * @param string $name The name of the actually log file, table, or
  122. * other specific store to use. Defaults to an
  123. * empty string, with which the subclass will
  124. * attempt to do something intelligent.
  125. *
  126. * @param string $ident The identity reported to the log system.
  127. *
  128. * @param array $conf A hash containing any additional configuration
  129. * information that a subclass might need.
  130. *
  131. * @param int $level Log messages up to and including this level.
  132. *
  133. * @return object Log The newly created concrete Log instance, or
  134. * null on an error.
  135. * @access public
  136. * @since Log 1.0
  137. */
  138. function &factory($handler, $name = '', $ident = '', $conf = array(),
  139. $level = PEAR_LOG_DEBUG)
  140. {
  141. $handler = strtolower($handler);
  142. $class = 'Log_' . $handler;
  143. $classfile = 'Log/' . $handler . '.php';
  144. /*
  145. * Attempt to include our version of the named class, but don't treat
  146. * a failure as fatal. The caller may have already included their own
  147. * version of the named class.
  148. */
  149. if (!Log::_classExists($class)) {
  150. include_once $classfile;
  151. }
  152. /* If the class exists, return a new instance of it. */
  153. if (Log::_classExists($class)) {
  154. $obj = new $class($name, $ident, $conf, $level);
  155. return $obj;
  156. }
  157. $null = null;
  158. return $null;
  159. }
  160. /**
  161. * Attempts to return a reference to a concrete Log instance of type
  162. * $handler, only creating a new instance if no log instance with the same
  163. * parameters currently exists.
  164. *
  165. * You should use this if there are multiple places you might create a
  166. * logger, you don't want to create multiple loggers, and you don't want to
  167. * check for the existance of one each time. The singleton pattern does all
  168. * the checking work for you.
  169. *
  170. * <b>You MUST call this method with the $var = &Log::singleton() syntax.
  171. * Without the ampersand (&) in front of the method name, you will not get
  172. * a reference, you will get a copy.</b>
  173. *
  174. * @param string $handler The type of concrete Log subclass to return.
  175. * Attempt to dynamically include the code for
  176. * this subclass. Currently, valid values are
  177. * 'console', 'syslog', 'sql', 'file', and 'mcal'.
  178. *
  179. * @param string $name The name of the actually log file, table, or
  180. * other specific store to use. Defaults to an
  181. * empty string, with which the subclass will
  182. * attempt to do something intelligent.
  183. *
  184. * @param string $ident The identity reported to the log system.
  185. *
  186. * @param array $conf A hash containing any additional configuration
  187. * information that a subclass might need.
  188. *
  189. * @param int $level Log messages up to and including this level.
  190. *
  191. * @return object Log The newly created concrete Log instance, or
  192. * null on an error.
  193. * @access public
  194. * @since Log 1.0
  195. */
  196. function &singleton($handler, $name = '', $ident = '', $conf = array(),
  197. $level = PEAR_LOG_DEBUG)
  198. {
  199. static $instances;
  200. if (!isset($instances)) $instances = array();
  201. $signature = serialize(array($handler, $name, $ident, $conf, $level));
  202. if (!isset($instances[$signature])) {
  203. $instances[$signature] = &Log::factory($handler, $name, $ident,
  204. $conf, $level);
  205. }
  206. return $instances[$signature];
  207. }
  208. /**
  209. * Abstract implementation of the open() method.
  210. * @since Log 1.0
  211. */
  212. function open()
  213. {
  214. return false;
  215. }
  216. /**
  217. * Abstract implementation of the close() method.
  218. * @since Log 1.0
  219. */
  220. function close()
  221. {
  222. return false;
  223. }
  224. /**
  225. * Abstract implementation of the flush() method.
  226. * @since Log 1.8.2
  227. */
  228. function flush()
  229. {
  230. return false;
  231. }
  232. /**
  233. * Abstract implementation of the log() method.
  234. * @since Log 1.0
  235. */
  236. function log($message, $priority = null)
  237. {
  238. return false;
  239. }
  240. /**
  241. * A convenience function for logging a emergency event. It will log a
  242. * message at the PEAR_LOG_EMERG log level.
  243. *
  244. * @param mixed $message String or object containing the message
  245. * to log.
  246. *
  247. * @return boolean True if the message was successfully logged.
  248. *
  249. * @access public
  250. * @since Log 1.7.0
  251. */
  252. function emerg($message)
  253. {
  254. return $this->log($message, PEAR_LOG_EMERG);
  255. }
  256. /**
  257. * A convenience function for logging an alert event. It will log a
  258. * message at the PEAR_LOG_ALERT log level.
  259. *
  260. * @param mixed $message String or object containing the message
  261. * to log.
  262. *
  263. * @return boolean True if the message was successfully logged.
  264. *
  265. * @access public
  266. * @since Log 1.7.0
  267. */
  268. function alert($message)
  269. {
  270. return $this->log($message, PEAR_LOG_ALERT);
  271. }
  272. /**
  273. * A convenience function for logging a critical event. It will log a
  274. * message at the PEAR_LOG_CRIT log level.
  275. *
  276. * @param mixed $message String or object containing the message
  277. * to log.
  278. *
  279. * @return boolean True if the message was successfully logged.
  280. *
  281. * @access public
  282. * @since Log 1.7.0
  283. */
  284. function crit($message)
  285. {
  286. return $this->log($message, PEAR_LOG_CRIT);
  287. }
  288. /**
  289. * A convenience function for logging a error event. It will log a
  290. * message at the PEAR_LOG_ERR log level.
  291. *
  292. * @param mixed $message String or object containing the message
  293. * to log.
  294. *
  295. * @return boolean True if the message was successfully logged.
  296. *
  297. * @access public
  298. * @since Log 1.7.0
  299. */
  300. function err($message)
  301. {
  302. return $this->log($message, PEAR_LOG_ERR);
  303. }
  304. /**
  305. * A convenience function for logging a warning event. It will log a
  306. * message at the PEAR_LOG_WARNING log level.
  307. *
  308. * @param mixed $message String or object containing the message
  309. * to log.
  310. *
  311. * @return boolean True if the message was successfully logged.
  312. *
  313. * @access public
  314. * @since Log 1.7.0
  315. */
  316. function warning($message)
  317. {
  318. return $this->log($message, PEAR_LOG_WARNING);
  319. }
  320. /**
  321. * A convenience function for logging a notice event. It will log a
  322. * message at the PEAR_LOG_NOTICE log level.
  323. *
  324. * @param mixed $message String or object containing the message
  325. * to log.
  326. *
  327. * @return boolean True if the message was successfully logged.
  328. *
  329. * @access public
  330. * @since Log 1.7.0
  331. */
  332. function notice($message)
  333. {
  334. return $this->log($message, PEAR_LOG_NOTICE);
  335. }
  336. /**
  337. * A convenience function for logging a information event. It will log a
  338. * message at the PEAR_LOG_INFO log level.
  339. *
  340. * @param mixed $message String or object containing the message
  341. * to log.
  342. *
  343. * @return boolean True if the message was successfully logged.
  344. *
  345. * @access public
  346. * @since Log 1.7.0
  347. */
  348. function info($message)
  349. {
  350. return $this->log($message, PEAR_LOG_INFO);
  351. }
  352. /**
  353. * A convenience function for logging a debug event. It will log a
  354. * message at the PEAR_LOG_DEBUG log level.
  355. *
  356. * @param mixed $message String or object containing the message
  357. * to log.
  358. *
  359. * @return boolean True if the message was successfully logged.
  360. *
  361. * @access public
  362. * @since Log 1.7.0
  363. */
  364. function debug($message)
  365. {
  366. return $this->log($message, PEAR_LOG_DEBUG);
  367. }
  368. /**
  369. * Returns the string representation of the message data.
  370. *
  371. * If $message is an object, _extractMessage() will attempt to extract
  372. * the message text using a known method (such as a PEAR_Error object's
  373. * getMessage() method). If a known method, cannot be found, the
  374. * serialized representation of the object will be returned.
  375. *
  376. * If the message data is already a string, it will be returned unchanged.
  377. *
  378. * @param mixed $message The original message data. This may be a
  379. * string or any object.
  380. *
  381. * @return string The string representation of the message.
  382. *
  383. * @access protected
  384. */
  385. function _extractMessage($message)
  386. {
  387. /*
  388. * If we've been given an object, attempt to extract the message using
  389. * a known method. If we can't find such a method, default to the
  390. * "human-readable" version of the object.
  391. *
  392. * We also use the human-readable format for arrays.
  393. */
  394. if (is_object($message)) {
  395. if (method_exists($message, 'getmessage')) {
  396. $message = $message->getMessage();
  397. } else if (method_exists($message, 'tostring')) {
  398. $message = $message->toString();
  399. } else if (method_exists($message, '__tostring')) {
  400. if (version_compare(PHP_VERSION, '5.0.0', 'ge')) {
  401. $message = (string)$message;
  402. } else {
  403. $message = $message->__toString();
  404. }
  405. } else {
  406. $message = var_export($message, true);
  407. }
  408. } else if (is_array($message)) {
  409. if (isset($message['message'])) {
  410. if (is_scalar($message['message'])) {
  411. $message = $message['message'];
  412. } else {
  413. $message = var_export($message['message'], true);
  414. }
  415. } else {
  416. $message = var_export($message, true);
  417. }
  418. } else if (is_bool($message) || $message === NULL) {
  419. $message = var_export($message, true);
  420. }
  421. /* Otherwise, we assume the message is a string. */
  422. return $message;
  423. }
  424. /**
  425. * Using debug_backtrace(), returns the file, line, and enclosing function
  426. * name of the source code context from which log() was invoked.
  427. *
  428. * @param int $depth The initial number of frames we should step
  429. * back into the trace.
  430. *
  431. * @return array Array containing four strings: the filename, the line,
  432. * the function name, and the class name from which log()
  433. * was called.
  434. *
  435. * @access private
  436. * @since Log 1.9.4
  437. */
  438. function _getBacktraceVars($depth)
  439. {
  440. /* Start by generating a backtrace from the current call (here). */
  441. $bt = debug_backtrace();
  442. /*
  443. * If we were ultimately invoked by the composite handler, we need to
  444. * increase our depth one additional level to compensate.
  445. */
  446. $class = isset($bt[$depth+1]['class']) ? $bt[$depth+1]['class'] : null;
  447. if ($class !== null && strcasecmp($class, 'Log_composite') == 0) {
  448. $depth++;
  449. $class = isset($bt[$depth + 1]) ? $bt[$depth + 1]['class'] : null;
  450. }
  451. /*
  452. * We're interested in the frame which invoked the log() function, so
  453. * we need to walk back some number of frames into the backtrace. The
  454. * $depth parameter tells us where to start looking. We go one step
  455. * further back to find the name of the encapsulating function from
  456. * which log() was called.
  457. */
  458. $file = isset($bt[$depth]) ? $bt[$depth]['file'] : null;
  459. $line = isset($bt[$depth]) ? $bt[$depth]['line'] : 0;
  460. $func = isset($bt[$depth + 1]) ? $bt[$depth + 1]['function'] : null;
  461. /*
  462. * However, if log() was called from one of our "shortcut" functions,
  463. * we're going to need to go back an additional step.
  464. */
  465. if (in_array($func, array('emerg', 'alert', 'crit', 'err', 'warning',
  466. 'notice', 'info', 'debug'))) {
  467. $file = isset($bt[$depth + 1]) ? $bt[$depth + 1]['file'] : null;
  468. $line = isset($bt[$depth + 1]) ? $bt[$depth + 1]['line'] : 0;
  469. $func = isset($bt[$depth + 2]) ? $bt[$depth + 2]['function'] : null;
  470. $class = isset($bt[$depth + 2]) ? $bt[$depth + 2]['class'] : null;
  471. }
  472. /*
  473. * If we couldn't extract a function name (perhaps because we were
  474. * executed from the "main" context), provide a default value.
  475. */
  476. if (is_null($func)) {
  477. $func = '(none)';
  478. }
  479. /* Return a 4-tuple containing (file, line, function, class). */
  480. return array($file, $line, $func, $class);
  481. }
  482. /**
  483. * Produces a formatted log line based on a format string and a set of
  484. * variables representing the current log record and state.
  485. *
  486. * @return string Formatted log string.
  487. *
  488. * @access protected
  489. * @since Log 1.9.4
  490. */
  491. function _format($format, $timestamp, $priority, $message)
  492. {
  493. /*
  494. * If the format string references any of the backtrace-driven
  495. * variables (%5 %6,%7,%8), generate the backtrace and fetch them.
  496. */
  497. if (preg_match('/%[5678]/', $format)) {
  498. list($file, $line, $func, $class) = $this->_getBacktraceVars(2);
  499. }
  500. /*
  501. * Build the formatted string. We use the sprintf() function's
  502. * "argument swapping" capability to dynamically select and position
  503. * the variables which will ultimately appear in the log string.
  504. */
  505. return sprintf($format,
  506. $timestamp,
  507. $this->_ident,
  508. $this->priorityToString($priority),
  509. $message,
  510. isset($file) ? $file : '',
  511. isset($line) ? $line : '',
  512. isset($func) ? $func : '',
  513. isset($class) ? $class : '');
  514. }
  515. /**
  516. * Returns the string representation of a PEAR_LOG_* integer constant.
  517. *
  518. * @param int $priority A PEAR_LOG_* integer constant.
  519. *
  520. * @return string The string representation of $level.
  521. *
  522. * @access public
  523. * @since Log 1.0
  524. */
  525. function priorityToString($priority)
  526. {
  527. $levels = array(
  528. PEAR_LOG_EMERG => 'emergency',
  529. PEAR_LOG_ALERT => 'alert',
  530. PEAR_LOG_CRIT => 'critical',
  531. PEAR_LOG_ERR => 'error',
  532. PEAR_LOG_WARNING => 'warning',
  533. PEAR_LOG_NOTICE => 'notice',
  534. PEAR_LOG_INFO => 'info',
  535. PEAR_LOG_DEBUG => 'debug'
  536. );
  537. return $levels[$priority];
  538. }
  539. /**
  540. * Returns the the PEAR_LOG_* integer constant for the given string
  541. * representation of a priority name. This function performs a
  542. * case-insensitive search.
  543. *
  544. * @param string $name String containing a priority name.
  545. *
  546. * @return string The PEAR_LOG_* integer contstant corresponding
  547. * the the specified priority name.
  548. *
  549. * @access public
  550. * @since Log 1.9.0
  551. */
  552. function stringToPriority($name)
  553. {
  554. $levels = array(
  555. 'emergency' => PEAR_LOG_EMERG,
  556. 'alert' => PEAR_LOG_ALERT,
  557. 'critical' => PEAR_LOG_CRIT,
  558. 'error' => PEAR_LOG_ERR,
  559. 'warning' => PEAR_LOG_WARNING,
  560. 'notice' => PEAR_LOG_NOTICE,
  561. 'info' => PEAR_LOG_INFO,
  562. 'debug' => PEAR_LOG_DEBUG
  563. );
  564. return $levels[strtolower($name)];
  565. }
  566. /**
  567. * Calculate the log mask for the given priority.
  568. *
  569. * This method may be called statically.
  570. *
  571. * @param integer $priority The priority whose mask will be calculated.
  572. *
  573. * @return integer The calculated log mask.
  574. *
  575. * @access public
  576. * @since Log 1.7.0
  577. */
  578. function MASK($priority)
  579. {
  580. return (1 << $priority);
  581. }
  582. /**
  583. * Calculate the log mask for all priorities up to the given priority.
  584. *
  585. * This method may be called statically.
  586. *
  587. * @param integer $priority The maximum priority covered by this mask.
  588. *
  589. * @return integer The resulting log mask.
  590. *
  591. * @access public
  592. * @since Log 1.7.0
  593. *
  594. * @deprecated deprecated since Log 1.9.4; use Log::MAX() instead
  595. */
  596. function UPTO($priority)
  597. {
  598. return Log::MAX($priority);
  599. }
  600. /**
  601. * Calculate the log mask for all priorities greater than or equal to the
  602. * given priority. In other words, $priority will be the lowest priority
  603. * matched by the resulting mask.
  604. *
  605. * This method may be called statically.
  606. *
  607. * @param integer $priority The minimum priority covered by this mask.
  608. *
  609. * @return integer The resulting log mask.
  610. *
  611. * @access public
  612. * @since Log 1.9.4
  613. */
  614. function MIN($priority)
  615. {
  616. return PEAR_LOG_ALL ^ ((1 << $priority) - 1);
  617. }
  618. /**
  619. * Calculate the log mask for all priorities less than or equal to the
  620. * given priority. In other words, $priority will be the highests priority
  621. * matched by the resulting mask.
  622. *
  623. * This method may be called statically.
  624. *
  625. * @param integer $priority The maximum priority covered by this mask.
  626. *
  627. * @return integer The resulting log mask.
  628. *
  629. * @access public
  630. * @since Log 1.9.4
  631. */
  632. function MAX($priority)
  633. {
  634. return ((1 << ($priority + 1)) - 1);
  635. }
  636. /**
  637. * Set and return the level mask for the current Log instance.
  638. *
  639. * @param integer $mask A bitwise mask of log levels.
  640. *
  641. * @return integer The current level mask.
  642. *
  643. * @access public
  644. * @since Log 1.7.0
  645. */
  646. function setMask($mask)
  647. {
  648. $this->_mask = $mask;
  649. return $this->_mask;
  650. }
  651. /**
  652. * Returns the current level mask.
  653. *
  654. * @return interger The current level mask.
  655. *
  656. * @access public
  657. * @since Log 1.7.0
  658. */
  659. function getMask()
  660. {
  661. return $this->_mask;
  662. }
  663. /**
  664. * Check if the given priority is included in the current level mask.
  665. *
  666. * @param integer $priority The priority to check.
  667. *
  668. * @return boolean True if the given priority is included in the current
  669. * log mask.
  670. *
  671. * @access protected
  672. * @since Log 1.7.0
  673. */
  674. function _isMasked($priority)
  675. {
  676. return (Log::MASK($priority) & $this->_mask);
  677. }
  678. /**
  679. * Returns the current default priority.
  680. *
  681. * @return integer The current default priority.
  682. *
  683. * @access public
  684. * @since Log 1.8.4
  685. */
  686. function getPriority()
  687. {
  688. return $this->_priority;
  689. }
  690. /**
  691. * Sets the default priority to the specified value.
  692. *
  693. * @param integer $priority The new default priority.
  694. *
  695. * @access public
  696. * @since Log 1.8.4
  697. */
  698. function setPriority($priority)
  699. {
  700. $this->_priority = $priority;
  701. }
  702. /**
  703. * Adds a Log_observer instance to the list of observers that are listening
  704. * for messages emitted by this Log instance.
  705. *
  706. * @param object $observer The Log_observer instance to attach as a
  707. * listener.
  708. *
  709. * @param boolean True if the observer is successfully attached.
  710. *
  711. * @access public
  712. * @since Log 1.0
  713. */
  714. function attach(&$observer)
  715. {
  716. if (!is_a($observer, 'Log_observer')) {
  717. return false;
  718. }
  719. $this->_listeners[$observer->_id] = &$observer;
  720. return true;
  721. }
  722. /**
  723. * Removes a Log_observer instance from the list of observers.
  724. *
  725. * @param object $observer The Log_observer instance to detach from
  726. * the list of listeners.
  727. *
  728. * @param boolean True if the observer is successfully detached.
  729. *
  730. * @access public
  731. * @since Log 1.0
  732. */
  733. function detach($observer)
  734. {
  735. if (!is_a($observer, 'Log_observer') ||
  736. !isset($this->_listeners[$observer->_id])) {
  737. return false;
  738. }
  739. unset($this->_listeners[$observer->_id]);
  740. return true;
  741. }
  742. /**
  743. * Informs each registered observer instance that a new message has been
  744. * logged.
  745. *
  746. * @param array $event A hash describing the log event.
  747. *
  748. * @access protected
  749. */
  750. function _announce($event)
  751. {
  752. foreach ($this->_listeners as $id => $listener) {
  753. if ($event['priority'] <= $this->_listeners[$id]->_priority) {
  754. $this->_listeners[$id]->notify($event);
  755. }
  756. }
  757. }
  758. /**
  759. * Indicates whether this is a composite class.
  760. *
  761. * @return boolean True if this is a composite class.
  762. *
  763. * @access public
  764. * @since Log 1.0
  765. */
  766. function isComposite()
  767. {
  768. return false;
  769. }
  770. /**
  771. * Sets this Log instance's identification string.
  772. *
  773. * @param string $ident The new identification string.
  774. *
  775. * @access public
  776. * @since Log 1.6.3
  777. */
  778. function setIdent($ident)
  779. {
  780. $this->_ident = $ident;
  781. }
  782. /**
  783. * Returns the current identification string.
  784. *
  785. * @return string The current Log instance's identification string.
  786. *
  787. * @access public
  788. * @since Log 1.6.3
  789. */
  790. function getIdent()
  791. {
  792. return $this->_ident;
  793. }
  794. }