PageRenderTime 32ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

/administrator/components/com_virtuemart/classes/Log/null.php

https://bitbucket.org/dgough/annamaria-daneswood-25102012
PHP | 84 lines | 23 code | 7 blank | 54 comment | 4 complexity | 3f25960b980439ca50bb6e8d6f80d338 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
  3. /**
  4. *
  5. * @version $Id: null.php 1336 2008-03-31 17:06:23Z soeren_nb $
  6. * @package VirtueMart
  7. * @subpackage Log
  8. * @copyright Copyright (C) 2004-2008 soeren - All rights reserved.
  9. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
  10. * VirtueMart is free software. This version may have been modified pursuant
  11. * to the GNU General Public License, and as distributed it includes or
  12. * is derivative of works licensed under the GNU General Public License or
  13. * other free or open source software licenses.
  14. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
  15. *
  16. * http://virtuemart.net
  17. */
  18. /**
  19. * $Header$
  20. *
  21. * @version $ Revision: 1.4 $
  22. * @package Log
  23. */
  24. /**
  25. * The vmLog_null class is a concrete implementation of the Log:: abstract
  26. * class. It simply consumes log events.
  27. *
  28. * @author Jon Parise <jon@php.net>
  29. * @since Log 1.8.2
  30. * @package Log
  31. *
  32. * @example null.php Using the null handler.
  33. */
  34. class vmLog_null extends vmLog
  35. {
  36. /**
  37. * Constructs a new vmLog_null object.
  38. *
  39. * @param string $name Ignored.
  40. * @param string $ident The identity string.
  41. * @param array $conf The configuration array.
  42. * @param int $level Log messages up to and including this level.
  43. * @access public
  44. */
  45. function vmLog_null($name, $ident = '', $conf = array(),
  46. $level = PEAR_LOG_DEBUG)
  47. {
  48. $this->_id = md5(microtime());
  49. $this->_ident = $ident;
  50. $this->_mask = vmLog::UPTO($level);
  51. }
  52. /**
  53. * Simply consumes the log event. The message will still be passed
  54. * along to any Log_observer instances that are observing this Log.
  55. *
  56. * @param mixed $message String or object containing the message to log.
  57. * @param string $priority The priority of the message. Valid
  58. * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
  59. * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
  60. * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
  61. * @return boolean True on success or false on failure.
  62. * @access public
  63. */
  64. function log($message, $priority = null)
  65. {
  66. /* If a priority hasn't been specified, use the default value. */
  67. if ($priority === null) {
  68. $priority = $this->_priority;
  69. }
  70. /* Abort early if the priority is above the maximum logging level. */
  71. if (!$this->_isMasked($priority)) {
  72. return false;
  73. }
  74. $this->_announce(array('priority' => $priority, 'message' => $message));
  75. return true;
  76. }
  77. }