log.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: liu21st <liu21st@gmail.com>
  10. // +----------------------------------------------------------------------
  11. use think\facade\Env;
  12. // +----------------------------------------------------------------------
  13. // | 日志设置
  14. // +----------------------------------------------------------------------
  15. return [
  16. // 默认日志记录通道
  17. 'default' => Env::get('log.channel', 'file'),
  18. // 日志记录级别
  19. 'level' => ['error', 'warning', 'fail', 'success', 'info', 'notice', 'crontab', 'crmeb', 'listener'],
  20. // 日志类型记录的通道 ['error'=>'email',...]
  21. 'type_channel' => [],
  22. //是否开启业务成功日志
  23. 'success_log' => false,
  24. //是否开启业务失败日志
  25. 'fail_log' => false,
  26. //是否开启定时任务日志
  27. 'timer_log' => false,
  28. //是否开启自定事件日志
  29. 'listener_log' => false,
  30. // 日志通道列表
  31. 'channels' => [
  32. 'file' => [
  33. // 日志记录方式
  34. 'type' => 'File',
  35. // 日志保存目录
  36. 'path' => app()->getRuntimePath() . 'log' . DIRECTORY_SEPARATOR,
  37. // 单文件日志写入
  38. 'single' => false,
  39. // 独立日志级别
  40. 'apart_level' => ['error', 'fail', 'success', 'crontab', 'crmeb', 'listener'],
  41. // 最大日志文件数量
  42. 'max_files' => 60,
  43. 'time_format' => 'Y-m-d H:i:s',
  44. 'format' => '%s|%s|%s'
  45. ],
  46. // 其它日志通道配置
  47. ],
  48. ];