Skip to content

Small laravel package for viewing api logs which can be used in debugging.

License

Notifications You must be signed in to change notification settings

espe-org/apilogger

 
 

Repository files navigation

API Logger

This is a small package that can helps in debugging api logs. It can log request method, url, duration, request payload, which models are retrieved, controller and method.

Installation

  1. In composer.json "require": { .... "espe-org/apilogger":"*" }, "repositories": [ { "type": "vcs", "url": "https://github.com/espe-org/apilogger" } ]

  2. Publish the config file with:

php artisan vendor:publish --tag=config --provider="AWT\Providers\ApiLogServiceProvider"

You can also configure which fields should not be logged like passwords, secrets, etc.

You dont need to migrate if you are just using file driver

php artisan migrate
  1. Add middleware named apilogger to the route or controller you want to log data
//in route.php or web.php
Route::middleware('apilogger')->post('/test',function(){
    return response()->json("test");
});
  1. Dashboard can be accessible via yourdomain.com/apilogs

Clear the logs

You can permenently clear the logs by using the following command.

php artisan apilog:clear

Implement your own log driver

From copy example/Apilogs to you app In apilog.php edit driver to \App\Apilogs\RESTLogger::class

License

The MIT License (MIT). Please see License File for more information.

About

Small laravel package for viewing api logs which can be used in debugging.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 79.6%
  • Blade 20.4%