LogCommonConfig.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace crmeb\services\wechat\config;
  12. use crmeb\services\wechat\contract\ConfigHandlerInterface;
  13. /**
  14. * 日志
  15. * Class LogCommonConfig
  16. * @package crmeb\services\wechat\config
  17. */
  18. class LogCommonConfig implements ConfigHandlerInterface
  19. {
  20. /**
  21. * 日志配置
  22. * @var array
  23. */
  24. protected $log = [];
  25. /**
  26. * LogCommonConfig constructor.
  27. */
  28. public function __construct()
  29. {
  30. $default = env('APP_DEBUG', false) ? 'prod' : 'dev';
  31. $this->log = [
  32. 'default' => $default, // 默认使用的 channel,生产环境可以改为下面的 prod
  33. 'channels' => [
  34. // 测试环境
  35. 'dev' => [
  36. 'driver' => 'single',
  37. 'path' => runtime_path() . 'easywechat.log',
  38. 'level' => 'debug',
  39. ],
  40. // 生产环境
  41. 'prod' => [
  42. 'driver' => 'daily',
  43. 'path' => runtime_path() . 'easywechat.log',
  44. 'level' => 'info',
  45. ],
  46. ],
  47. ];
  48. }
  49. public function set(string $key, $value)
  50. {
  51. }
  52. /**
  53. * @param string|null $key
  54. * @return array|mixed
  55. */
  56. public function get(string $key = null)
  57. {
  58. return $this->log;
  59. }
  60. /**
  61. * @return array
  62. */
  63. public function all(): array
  64. {
  65. return $this->log;
  66. }
  67. }