Base for a static organization website

DebugKitLog.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * Redistributions of files must retain the above copyright notice.
  8. *
  9. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  10. * @link http://cakephp.org CakePHP(tm) Project
  11. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  12. */
  13. /**
  14. * A CakeLog listener which saves having to munge files or other configured loggers.
  15. *
  16. */
  17. class DebugKitLog implements CakeLogInterface {
  18. /**
  19. * logs
  20. *
  21. * @var array
  22. */
  23. public $logs = array();
  24. /**
  25. * Makes the reverse link needed to get the logs later.
  26. *
  27. * @param $options
  28. * @return \DebugKitLog
  29. */
  30. public function __construct($options) {
  31. $options['panel']->logger = $this;
  32. }
  33. /**
  34. * Captures log messages in memory
  35. *
  36. * @param $type
  37. * @param $message
  38. * @return void
  39. */
  40. public function write($type, $message) {
  41. if (!isset($this->logs[$type])) {
  42. $this->logs[$type] = array();
  43. }
  44. $this->logs[$type][] = array(date('Y-m-d H:i:s'), (string)$message);
  45. }
  46. }