BaseLog.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * Base Log Engine class
  4. *
  5. * PHP 5
  6. *
  7. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  8. * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  9. *
  10. * Licensed under The MIT License
  11. * Redistributions of files must retain the above copyright notice.
  12. *
  13. * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  14. * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
  15. * @package Cake.Log.Engine
  16. * @since CakePHP(tm) v 2.2
  17. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  18. */
  19. App::uses('CakeLogInterface', 'Log');
  20. /**
  21. * Base log engine class.
  22. *
  23. * @package Cake.Log.Engine
  24. */
  25. abstract class BaseLog implements CakeLogInterface {
  26. /**
  27. * Engine config
  28. *
  29. * @var string
  30. */
  31. protected $_config = array();
  32. /**
  33. * __construct method
  34. *
  35. * @param array $config Configuration array
  36. * @return void
  37. */
  38. public function __construct($config = array()) {
  39. $this->config($config);
  40. }
  41. /**
  42. * Sets instance config. When $config is null, returns config array
  43. *
  44. * Config
  45. *
  46. * - `types` string or array, levels the engine is interested in
  47. * - `scopes` string or array, scopes the engine is interested in
  48. *
  49. * @param array $config engine configuration
  50. * @return array
  51. */
  52. public function config($config = array()) {
  53. if (!empty($config)) {
  54. if (isset($config['types']) && is_string($config['types'])) {
  55. $config['types'] = array($config['types']);
  56. }
  57. $this->_config = $config;
  58. }
  59. return $this->_config;
  60. }
  61. }