PHP Classes

PHP MonoLog Processor: Improve information logged on error using Monolog

Recommend this page to a friend!
  Info   View files Documentation   View files View files (21)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-03 (3 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 28 This week: 28All time: 11,007 This week: 3Up
Version License PHP version Categories
mono-processor 1.0MIT/X Consortium ...7Debug, Libraries, Logging, PHP 7
Description 

Author

This package can improve information logged on error using Monolog.

It provides a processor service class that can extend the possibilities of the Monolog error log class.

Currently, it can add to the logs details of:

- SQL queries

- HTTP requests

- Authorized user

- Request route

- PHP version information

- Git version and commit identifier of the error code file

Picture of Andrey Iatsenko
  Performance   Level  
Name: Andrey Iatsenko <contact>
Classes: 6 packages by
Country: Russian Federation Russian Federation
Innovation award
Innovation award
Nominee: 5x

Documentation

MonoProcessor - Supplement your logging with auxiliary information on error

Packagist Version Packagist Downloads Packagist Downloads

This Processor will display in the logs bread crumbs by which you can more quickly and accurately identify the cause of the error.

:scroll: Installation

The package can be installed via composer:

composer require yzen.dev/mono-processor

To get started, first publish MonoProcessor config and view files into your own project:

php artisan vendor:publish --provider "MonoProcessor\ServiceProvider"

:scroll: Version Compatibility

| Laravel | MonoProcessor | | ------- | ------------- | | v8.x | v1.x | | v7.x | v0.3.x |

:scroll: Features

  • Extends standard logs
  • Collection of SQL requests
  • Collection of HTTP requests
  • Authorized user information
  • Route information
  • Git information
  • PHP information
  • Memory information

:scroll: Usage

To use MonoProcessor you need to add the following tap to your logging.php config:

    'channels' => [
        'daily' => [
            'driver' => 'daily',
            'path' => storage_path('logs/laravel.log'),
            'level' => 'debug',
            'days' => env('LOG_DAYS', 7),
            'tap' => [
                MonoProcessor\MonoProcessors::class
            ]
        ]
    ]

As a result, you will get approximately the following information after the stack: example

:scroll: Configuration

| Processor | Description | | ----------------- | ------------------------------------------------------------ | | stacktrace | Stack output when an error occurs | | memoryPeak | Memory peak at runtime | | git | Git branch and Git commit SHA | | phpinfo | php info (version) | | json_format | Output of additional information in the format JSON_PRETTY_PRINT| | command | Listen console commands | | levels | levels (DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY)| | uuid | Adds a unique identifier | | ----------------- | ------------------------------------------------------------ | | request | Logging of the received request | | request.base_info | add request host,ip,url,method | | request.header | add request header | | request.body | add request body | | ----------------- | ------------------------------------------------------------ | | breadcrumbs | What breadcrumbs do you need to collect | | breadcrumbs.auth | auth info | | breadcrumbs.sql | List of sql queries | | breadcrumbs.route | route info (name,action) |

You can also get all harvested breadcrumbs using the get_breadcrumbs() method.


  Files folder image Files  
File Role Description
Files folder image.github (1 directory)
Files folder imagesrc (5 files, 3 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file phpcs.xml Data Auxiliary data
Accessible without login Plain text file phpstan.neon Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file php.yml Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageconfig (1 file)
Files folder imageHelpers (2 files, 1 directory)
Files folder imageProcessors (6 files)
  Plain text file Breadcrumbs.php Class Class source
  Plain text file Config.php Class Class source
  Plain text file EventHandler.php Class Class source
  Plain text file MonoProcessors.php Class Class source
  Plain text file ServiceProvider.php Class Class source

  Files folder image Files  /  src  /  config  
File Role Description
  Accessible without login Plain text file mono-processor.php Conf. Configuration script

  Files folder image Files  /  src  /  Helpers  
File Role Description
Files folder imageglobal (1 file)
  Plain text file LogLevel.php Class Class source
  Plain text file Uuid.php Class Class source

  Files folder image Files  /  src  /  Helpers  /  global  
File Role Description
  Accessible without login Plain text file breadcrumbs_functions.php Aux. Auxiliary script

  Files folder image Files  /  src  /  Processors  
File Role Description
  Plain text file BreadcrumbsProcessor.php Class Class source
  Plain text file GitInfoProcessor.php Class Class source
  Plain text file MemoryProcessor.php Class Class source
  Plain text file PhpInfoProcessor.php Class Class source
  Plain text file RequestProcessor.php Class Class source
  Plain text file UuidProcessor.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:28
This week:28
All time:11,007
This week:3Up