aungwinthant / apilogger Goto Github PK
View Code? Open in Web Editor NEWSmall laravel package for viewing api logs which can be used in debugging.
License: MIT License
Small laravel package for viewing api logs which can be used in debugging.
License: MIT License
Is there anyway to export view and src files ? so one can modify them according to requirements ? @aungwinthant
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.
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).
[
{
"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
Declaration of AWT\Http\Controllers\ApiLogController::index(AWT\Contracts\ApiLoggerInterface $logger) should be compatible with App\Http\Controllers\Controller::index(Illuminate\Http\Request $request)
The route where the logs are shown/available should be configurable such that:
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.
Consider adding the ability for the package to be auto-discovered.
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]
This debug seems to have crept in:
apilogger/src/AbstractLogger.php
Line 29 in cbfc37e
when i install this package i got this error
In ApiLogServiceProvider.php line 53:
Unsupported Driver
any idea how to fix this?
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).
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).
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.
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
I got the needle and haystack around the wrong way too at:
apilogger/src/AbstractLogger.php
Line 51 in cbfc37e
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
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
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! 🤩
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.
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?
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.
I hope it will help.
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)
Hi,
I've notice that the log tables are created even if i choose file as driver, there is a way to disable log table creation on file driver?
thank you
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}
Hey,
Keen to help out on this package and do several improvements.
Let me know what you think about the following:
Please add pagination to the logs if possible
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.