Code Monkey home page Code Monkey logo

laravel-logable's Introduction

Laravel Logable is a simple way to log http request in your Laravel application.

Requirements

php >= 7.4

Laravel version >= 6.0

Installation

composer require sagar290/laravel-logable

You need add this configuration in config/logging.php file in channels array.

'channels' => [
    .....
    'logable' => [
        'driver' => 'daily',
        'path' => storage_path('logs/logable.log'),
        'level' => 'debug',
    ],
]

Add this middleware to your app/Http/Kernel.php file.

protected $middleware = [
    ...
    \Sagar290\Logable\Middleware\RouteLogMiddleware::class,
];

Publish configuration file.

php artisan vendor:publish --provider="Sagar290\Logable\LogableServiceProvider" --tag="config"

Commands

monitoring logs

php artisan logs:monitor

image laravel logable

This will live monitor all incoming requests and log them to the log file.

Clear logs

php artisan logs:clear

This will clear all logs.

Conclusion

Please feel free raise an issue if you have problem. Also, feel free to star this repository on Github. Contribute to this project by making a pull request.

laravel-logable's People

Contributors

sagar290 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

laravel-logable's Issues

Configurable option need to collect the logs

The current implementation will be logged each and every HTTP request but in production mode, I need this package only some debugging time. So if there is any option like env('LOG_HTTTP_REQUESTS', false), it will be better to check this value in middleware when you are trying to log current HTTP requests.

Clear log command will removed all logs intentionally

From a user perspective, if I set a storage path to log my HTTP request log then I want to remove all logs related to HTTP request logs not all kinds of logs. Current scenario I logged several things on the logs folder. If I use this clear command of this package it will remove my entire application logs and a fallback log file (laravel.log) containing entire application logs so sometimes it's important.

So I think we can remove only the HTTP request log files if the solid path is provided on config and matched, if not then no need to remove the fallback file.

Specific path logging config

This is a minor feature request, Sometimes I need to debug only specific some routes so if I can specify some of the routing paths in the config and this package only log those routes it will be a good option for debugging

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.