承接 erloom/logger 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

erloom/logger

最新稳定版本:1.3.0

Composer 安装命令:

composer require erloom/logger

包简介

Create Log and Middleware for routes.

README 文档

README

This package used with Filebeat on your server to generate log file within Laravel 6.x and above. Logging file later will be consumed to Logstash for logging purpose.

The feature of this package :

  • Convert Laravel Log into JSON formatting using channel dailybeat
  • Create Laravel Endpoint Log into JSON formatting using channel monitor
  • Create new Middleware alias for channel monitor to implement on your REST API, with a Middleware alias named request.log

Installation

  • Install with composer require erloom/logger, later you can use the 2 features available separately based on the installation instructions.

Change Usual log into JSON + Daily format

  • To change your usual logging into JSON, change your LOG_CHANNEL into dailybeat
    LOG_CHANNEL=dailybeat
    ...
    
  • Later, your logs will be generated at storage/logs with this format :
    
    
  • laravel-2021-03-04.log
  • laravel-2021-03-05.log ...
    with this content :
    

    {"@timestamp":"2021-03-04T11:20:36.053490+00:00","@version":1,"host":"xxx.local","message":"Test","type":"Laravel","channel":"local","level":"ERROR","monolog_level":400}

    
    

Log your REST API

  • To log your endpoint, the package automatically register middleware called request.log in your application. You can use it within your API routes.

    Route::get('/test', function (Request $request) {
      return 'Test';
    })->middleware('request.log');
    
  • Later, your logs will be generated at storage/logs with this format :

    
    
  • monitor-2021-03-04.log
  • monitor-2021-03-05.log ...
    with this content :
    

    {"@timestamp":"2021-10-04T09:37:09.348133+00:00","@version":1,"host":"xxx.local","message":"request_monitor","type":"Laravel","channel":"local","level":"INFO","monolog_level":200,"context":{"url":"YOUR_API_ROUTE","controller":null,"action":"Closure","request_method":"GET","ip_address":"REQUESTER_IP","user_agent":"USER_AGENT","request_body":"","response_status":200,"response_body":"Test","duration":18.95594596862793}}

    
    

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-04