Git Product home page Git Product logo

apilogger's People

Contributors

aungwinthant avatar bienvenu007 avatar dansleboby avatar jacow avatar johnroux avatar lloy0076 avatar mikeerickson avatar setkyar avatar t1sh0o avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

apilogger's Issues

HOw to protected api logger

Hi i am new in laravel can you pls guide me how to make password protected api logger

i follow all given command which given by you.

thanks in advance.

Automated Tests

It would be good to figure out how one might add some automated tests (so that it's less likely when others or I submit a PR we make a regression).

Laravel 6.X | Undefined Offset Bug?

[
    {
        "id": 1,
        "testCamelCase": "Camel Case",
        "testSnakeCase": null,
        "test_snake_case": "Snake Case"
    }
]

{
    "message": "Undefined offset: 1",
    "exception": "ErrorException",
    "file": "C:\\laragon\\webroots\\current\\laravel-six\\vendor\\awt\\apilogger\\src\\AbstractLogger.php",
    "line": 48,
    "trace": [
        {
            "file": "C:\\laragon\\webroots\\current\\laravel-six\\vendor\\awt\\apilogger\\src\\AbstractLogger.php",
            "line": 48,
            "function": "handleError",
            "class": "Illuminate\\Foundation\\Bootstrap\\HandleExceptions",
            "type": "->"
        },
        {
            "file": "C:\\laragon\\webroots\\current\\laravel-six\\vendor\\awt\\apilogger\\src\\DBLogger.php",
            "line": 33,
            "function": "logData",
            "class": "AWT\\AbstractLogger",
            "type": "->"
        },
        {
            "file": "C:\\laragon\\webroots\\current\\laravel-six\\vendor\\awt\\apilogger\\src\\Http\\Middleware\\ApiLogger.php",
            "line": 30,
            "function": "saveLogs",
            "class": "AWT\\DBLogger",
            "type": "->"
        },
        {
            "file": "C:\\laragon\\webroots\\current\\laravel-six\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
            "line": 218,
            "function": "terminate",
            "class": "AWT\\Http\\Middleware\\ApiLogger",
            "type": "->"
        },
        {
            "file": "C:\\laragon\\webroots\\current\\laravel-six\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
            "line": 189,
            "function": "terminateMiddleware",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "C:\\laragon\\webroots\\current\\laravel-six\\public\\index.php",
            "line": 60,
            "function": "terminate",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        }
    ]
}```

ErrorException

ErrorException
Declaration of AWT\Http\Controllers\ApiLogController::index(AWT\Contracts\ApiLoggerInterface $logger) should be compatible with App\Http\Controllers\Controller::index(Illuminate\Http\Request $request)

Allow `apilogs` Route to be Configurable

The route where the logs are shown/available should be configurable such that:

  • They do not exist at all ;
  • They can be put somewhere configurable (e.g. /another/place/apilogs).

Error while installing this package

Hi,
I tired installing the package but I got following error.

Class AWT\Http\Exceptions\InvalidApiLogDriverException located in D:/laragon/www/eazy-customs-api/vendor/awt/apilogger/src\Exceptions\InvalidApiLogDriverException.php does not comply with psr-4 autoloading standard. Skipping.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In ApiLogServiceProvider.php line 59:

  Class 'AWT\Http\Exceptions\InvalidApiLogDriverException' not found


Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Continued support

I am curious if you have plans for continued support and maintenance. If not, I would very much be interested in becoming maintainer? Let me know if you are interested.

Mike Erickson
[email protected]

Log file date format

I am looking for a way to customize the date format in API log files? I checked the apilog.php file but doesn't exist.

Personally, I would like to have same format used by Laravel logs

Eg.

apilogger-2019-08-08.log

or, better yet in my desired format

api-2019-08-08.log

Possible config entry

<?php

return [
    //currently supported drivers are 'db' and 'file'
    "driver" => "file",
    "filename" => "api-yyyy-mm-dd.log"
];

Thinking of a quick change to FileLogger.php:61

   $filename = 'api-'.date('Y-m-d') . '.log';

If you are interested, I would be happy to make a PR for this (unless you already have plans for this capability).

Allow `apilogs` to be Protected by a Guard

It seems at the moment that any user can see the logs (in /apilogs); obviously this could be a security issue.

It could be optional to protect that route(s) with a guard (which could be configurable).

User context is missing

Hi,
it seems to be a great package. However it would be nice to see what user accesed some particular endpoint. In my case - user_id, username, email, company_id (from JWT payload) would be required.

Please Downgrade The PHP Version

Thank you for updating the log interface.
But, may you downgrade the minimum php version ?

Because many of my project using this lib on for laravel 5.5 and laravel 6.0 that using php 7.2
After you new commit, it makes this lib only available with minimum php 8 that makes me can't install it on the old version of laravel. The minimum php 8 force the developer to upgrade minimum laravel 8.0.

Please, download the php version.
Thank you so much

Deprecation Notice on "composer dumpautoload"

Deprecation Notice: Class AWT\Http\Exceptions\InvalidApiLogDriverException located in ./vendor/awt/apilogger/src/Exceptions/InvalidApiLogDriverException.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.10/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201

Provide some basic filtering in `apilogs` route

I am not so much making an issue here, but rather opening some dialog about enhancing the apilogs route to include some basic filtering or query functions.

I am thinking maybe allowing some sort of search functionality, or filter request type, etc. This apilogs route could get very big and hard to navigate in a hurry.

Perhaps at a minimum, maybe show a drop-down to select the desired day in the file logger is being used (which it is in my case). In my local usage, I was trying to track down some entries for the last couple of days of use, but it was a "massive" list already.

I suppose I could use the DB logger and navigate using TablePlus or SequelPro, but I really don't want to log to the database if I can avoid it, much rather use FileLogger

If anybody wants to chime in here, I am all ears

Save API response

It would be nice if the project saved api's response for each request as well. Do you think it's possible?

BTW, that’s awesome!! Congrats! 🤩

Restore Code Removed by PR #8.

I took out:


        $endTime = microtime(true);

        $implode_models = $this->models;

        array_walk($implode_models, function(&$value, $key) {
            $value = "{$key} ({$value})";
        });

By accident.

See PR #10.

ApiLoggerInterface Issue

Hello,

Laravel version: "laravel/framework": "^6.18.35"
I'm using the below 2 packages at the same time:

"awt/apilogger": "dev-master"
"tightenco/ziggy": "^1.0"

I've added @routes to some blade files which will be used to get all routes in the javascript files. Now I wanted to add some other packages and after installing/removing other packages I'm getting the error in pages where I've added @routes

I tried removing, installing, and updating the package. Also, checked some solutions and tried this one (Stackoverflow).

The error screenshot is attached. Can I get the solution for the same?

Error

[Laravel 6.0.4] Auto-Discovery and config Publish didn't work

Hi,

First of all, thank you for your work.

I am using Laravel version 6.0.4 and composer version 1.9.0.

I followed the README and add apilogger to composer. But the apilogger service provider didn't show on package discovery. That's my first issue.

I executed the command to publish the vendor. The apilog.php file has not been added to the config Laravel's folder. That's my second issue. It might be link to the first issue.

So i add manualy the config file and the apilogger service provider and it works.

  • Is there something i am missing ?
  • Is related to Laravel 6.0 (i didn't test with oldest version) ? Other packages didn't have the issue.

I hope it will help.

Forked Version Under Development

I have been using this package for quite sometime and kind of bummed it does not receive the attention that some of us have hoped for (with the various comments and PRs)

I am in the process of revamping for personal use and wanted to share what I have created for the API Logger UI (I use this a lot personally)

honu salon 2020-04-25 16-04-28

honu salon 2020-04-25 13-17-54

honu salon 2020-04-25 13-17-32

Call to undefined method

I followed the installation and get this error:

Call to undefined method Symfony\Component\HttpFoundation\StreamedResponse::status() {"userId":1,"exception":"[object] (Error(code: 0): Call to undefined method Symfony\\Component\\HttpFoundation\\StreamedResponse::status() at /home/vagrant/code/testapi/vendor/awt/apilogger/src/AbstractLogger.php:80)
[stacktrace]
#0 /home/vagrant/code/testapi/vendor/awt/apilogger/src/FileLogger.php(61): AWT\\AbstractLogger->logData()
#1 /home/vagrant/code/testapi/vendor/awt/apilogger/src/Http/Middleware/ApiLogger.php(30): AWT\\FileLogger->saveLogs()
#2 /home/vagrant/code/testapi/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(207): AWT\\Http\\Middleware\\ApiLogger->terminate()
#3 /home/vagrant/code/testapi/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(178): Illuminate\\Foundation\\Http\\Kernel->terminateMiddleware()
#4 /home/vagrant/code/testapi/public/index.php(60): Illuminate\\Foundation\\Http\\Kernel->terminate()
#5 {main}

Large Update required

Hey,

Keen to help out on this package and do several improvements.

Let me know what you think about the following:

Routes

  • Add config option for route guards
  • Add config option for route existing
  • Add config option for route path

Logger

  • Change config option for driver to allow for class names, if the class is an instance of 'ApiLoggerInterface' then automatically allow it (this should allow for far easier overriding of the loggers
  • Add config option for when the response body should be saved (>400, >500 etc)
  • Add config option for a blacklist array for request variables (eg: password)

View

  • Add config options for which things to show on the view page
  • Add response body as an option

General

  • Fix the bug where the database table is created when not using that driver

Repo

  • Contribution Guidelines
  • Build out a Wiki

Paginate

Please add pagination to the logs if possible

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.