定制 jk/monolog-request-header-processor 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jk/monolog-request-header-processor

最新稳定版本:1.0.0

Composer 安装命令:

composer require jk/monolog-request-header-processor

包简介

Monolog processor which injects HTTP request headers into the log

README 文档

README

I needed something to log and debug my Amazon Alexa skill which sends POST request to my server. So here it is.

How to use it

use Monolog\Logger;

$log = new Monolog\Logger('test');
$log->pushProcessor(new \JK\Monolog\Processor\RequestHeaderProcessor());
$log->pushHandler(…);

$log->notice('Noticed something');

Sample output

This is the sample output of a normal GET request

[2017-08-28 13:04:09] test.NOTICE: Noticed something [] {"Host":"localhost","Connection":"keep-alive","Cache-Control":"max-age=0","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36","Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","DNT":"1","Accept-Encoding":"gzip, deflate, br","Accept-Language":"de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4"}

So the extra information in pretty print is:

{  
	"Host":"localhost",
	"Connection":"keep-alive",
	"Cache-Control":"max-age=0",
	"Upgrade-Insecure-Requests":"1",
	"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36",
	"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
	"DNT":"1",
	"Accept-Encoding":"gzip, deflate, br",
	"Accept-Language":"de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4"
}

统计信息

  • 总下载量: 581.13k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 1

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-28