log.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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'],
  20. // 日志类型记录的通道 ['error'=>'email',...]
  21. 'type_channel' => [],
  22. //是否开启业务成功日志
  23. 'success_log' => false,
  24. //是否开启业务失败日志
  25. 'fail_log' => false,
  26. //是否开启定时任务日志
  27. 'timer_log' => false,
  28. // 日志通道列表
  29. 'channels' => [
  30. 'file' => [
  31. // 日志记录方式
  32. 'type' => 'File',
  33. // 日志保存目录
  34. 'path' => app()->getRuntimePath() . 'log' . DIRECTORY_SEPARATOR,
  35. // 单文件日志写入
  36. 'single' => false,
  37. // 独立日志级别
  38. 'apart_level' => ['error', 'fail', 'success', 'crontab', 'crmeb'],
  39. // 最大日志文件数量
  40. 'max_files' => 60,
  41. 'time_format' => 'Y-m-d H:i:s',
  42. 'format' => '%s|%s|%s'
  43. ],
  44. // 其它日志通道配置
  45. ],
  46. ];