Download the PHP package tp5er/think-http-logger without Composer
On this page you can find all versions of the php package tp5er/think-http-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download tp5er/think-http-logger
More information about tp5er/think-http-logger
Files in tp5er/think-http-logger
Download tp5er/think-http-logger
More information about tp5er/think-http-logger
Files in tp5er/think-http-logger
Vendor tp5er
Package think-http-logger
Short Description A Thinkphp package to log HTTP requests
License MIT
Package think-http-logger
Short Description A Thinkphp package to log HTTP requests
License MIT
Keywords thinkphpthink-http-logger
Please rate this library. Is it a good library?
Informations about the package think-http-logger
这个包添加了一个中间件,可以将传入的请求记录到默认日志中。 如果在用户请求期间出现任何问题,您仍然可以访问该用户发送的原始请求数据。
配置文件config/http-logger.php
内容:
路由中使用
Route::get('think', function () {
return 'hello,ThinkPHP6!';
})->middleware(\tp5er\think\HttpLogger\Middlewares\HttpLogger::class);
全局app/middleware.php
自定义日志编写器必须实现 \tp5er\think\HttpLogger\LogWriter。 这个接口需要你实现logRequest。
// Example implementation from ` \tp5er\think\HttpLogger\DefaultLogWriter`
public function logRequest(Request $request): void
{
$method = strtoupper($request->method());
$uri = $request->pathinfo();
$bodyAsJson = json_encode($request->all());
$message = "{$method} {$uri} - {$bodyAsJson}";
Log::channel(config('http-logger.log_channel'))->info($message);
}
All versions of think-http-logger with dependencies
PHP Build Version
Package Version
Requires
php Version
^7.2|^8.0.2
ext-json Version *
ext-json Version *
The package tp5er/think-http-logger contains the following files
Loading the files please wait ....